Post Reply 
About calculator benchmark (8 queens) and fast devices. MS challenge #2
05-09-2017, 05:43 PM
Post: #21
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
(05-09-2017 04:03 PM)pier4r Wrote:  Since I cannot send you a pm, remember that the wiki is open Smile . Everyone can contribute.

Added the new result and code to the page of the challenge.

Thanks. I would swear that private messaging was enabled by default because I have a few private messages in my mailbox ... Strange ... Re-enabled ...

https://www.hrastprogrammer.com/hrastwood/
https://hrastprogrammer.bandcamp.com/
Visit this user's website Find all posts by this user
Quote this message in a reply
12-26-2018, 04:19 AM
Post: #22
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
From Calculator Benchmark
0.130 FX-CG50 MicroPython / OS 3.20
Code:

MicroPython -------------

def nqueens(): for i in range(100): a = [0] * 9 r = 8 s = 0 x = 0 y = 0 t = 0 while True: x += 1 a[x] = r while True: s += 1 y = x while y>1: y -= 1 t = a[x]-a[y] if t==0 or x-y==abs(t): y=0 a[x] -= 1 while a[x]==0: x -= 1 a[x] -= 1 if y==1: break; if x==r: break; print(s)


This seems a remarkably fast result.
Does it really outperform the prime D ?

0.158 HP-Prime Formula / List / G2 / HW.D
Code:
EXPORT NQUEENS() BEGIN R:=8; L1:=MAKELIST(0,X,1,R,1); S:=0; X:=0; REPEAT X:=X+1; L1(X):=R; REPEAT S:=S+1; Y:=X; WHILE Y>1 DO Y:=Y-1; T:=L1(X)-L1(Y); IF T==0 OR X-Y==ABS(T) THEN Y:=0; L1(X):=L1(X)-1; WHILE L1(X)==0 DO X:=X-1; L1(X):=L1(X)-1; END; END; END; UNTIL Y==1 END; UNTIL X==R END; S; END;
Find all posts by this user
Quote this message in a reply
12-28-2018, 02:37 PM
Post: #23
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
A simple explanation could be a more efficient bytecode interpreter. If I'm not mistaken, the CPU frequency of the CG50 is 59 MHz only, while executing MicroPython.

Calculator Benchmark
Find all posts by this user
Quote this message in a reply
12-28-2018, 02:58 PM
Post: #24
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
(12-28-2018 02:37 PM)xerxes Wrote:  A simple explanation could be a more efficient bytecode interpreter. If I'm not mistaken, the CPU frequency of the CG50 is 59 MHz only, while executing MicroPython.

It could be. Another datapoint is the benchmark results given here:
http://www.hpmuseum.org/forum/thread-975...l#pid86751

Here the Prime G2 is an order of magnitude faster than CG50 MicroPython. Thats why I questioned the faster than G2 result here, esp given the low clockspeed of 59MHz.
Find all posts by this user
Quote this message in a reply
12-28-2018, 03:46 PM
Post: #25
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
Yes, the Prime is one of the fastest for many tasks, but an integer benchmark like n-queens is more focused on the efficiency of the
language itself and not on the mathematical or graphical functions. The HP-200LX with Turbo C for example is faster than the Prime
with n-queens but much slower at mathematical functions.

Calculator Benchmark
Find all posts by this user
Quote this message in a reply
12-28-2018, 05:46 PM
Post: #26
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
(12-28-2018 03:46 PM)xerxes Wrote:  Yes, the Prime is one of the fastest for many tasks, but an integer benchmark like n-queens is more focused on the efficiency of the
language itself and not on the mathematical or graphical functions. The HP-200LX with Turbo C for example is faster than the Prime
with n-queens but much slower at mathematical functions.

Yes I can see how C could speed up a slow calc. Im just very surprised that taking into account clock differences, the language efficiency of the G2 is only about 10% of the CG50 running Micropython. My initial thought was the decimal point may have slipped to the left as mistakes can and do sometimes happen! Thanks for the explanation.
Find all posts by this user
Quote this message in a reply
12-28-2018, 08:20 PM
Post: #27
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
(12-28-2018 02:58 PM)Stevetuc Wrote:  Here the Prime G2 is an order of magnitude faster than CG50 MicroPython.
The astronomer (and the rebellion) in me always comes to a hiccup when this particular term comes up.
Does anyone actually know what "one order of magnitude" really means? Wink
One order of magnitude is the 5th root of 100 or ca 2,511886431509580111085032067799328 (according to my DM42)
Astronomically, stars are odered by brightness in magnitudes.
A magnitude 6 star is the faintest one (normally) can see with the naked eye in a lightunpolluted sky. A magnitude 1 star is 100 times brighter. Each magnitude is determined by ~2,512^x where x starts with 0 at mag. 6 (2,512^0=1) and 5 (2,512^5=~100) at mag. 1. So, a mag. 6 star is "1" bright and a mag 1 star is "100" bright.

Star magnitudes

(Post should be taken as Wink )

Yes, and a continous merry christmas and a coming prosperous new year to all.

Esben
15C CE, 28s, 35s, 49G+, 50G, Prime G2 HW D, SwissMicros DM32, DM42, DM42n, WP43 Pilot
Elektronika MK-52 & MK-61
Find all posts by this user
Quote this message in a reply
12-28-2018, 08:31 PM (This post was last modified: 12-28-2018 08:32 PM by pier4r.)
Post: #28
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
(12-28-2018 08:20 PM)DA74254 Wrote:  Does anyone actually know what "one order of magnitude" really means? Wink

Wikipedia is quite clear.

https://en.wikipedia.org/wiki/Order_of_magnitude

A sentence can be used in different contexts.

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
12-28-2018, 09:09 PM
Post: #29
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
(12-28-2018 08:31 PM)pier4r Wrote:  
(12-28-2018 08:20 PM)DA74254 Wrote:  Does anyone actually know what "one order of magnitude" really means? Wink

Wikipedia is quite clear.

https://en.wikipedia.org/wiki/Order_of_magnitude

A sentence can be used in different contexts.

Which means that "an order of magnitude" can be slower. For instance, let us set a calculation that my Prime performs in 0,432 secs. Then my "other" calc does the same in "an order of 10 times the magnitude". So, in 0,432 secs it has performed 0,000226379693794 of the work that my Prime has done.. Wink (0,432^10=~2,26*10^-4)

Esben
15C CE, 28s, 35s, 49G+, 50G, Prime G2 HW D, SwissMicros DM32, DM42, DM42n, WP43 Pilot
Elektronika MK-52 & MK-61
Find all posts by this user
Quote this message in a reply
12-28-2018, 09:18 PM (This post was last modified: 12-28-2018 09:18 PM by pier4r.)
Post: #30
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
(12-28-2018 09:09 PM)DA74254 Wrote:  Which means that "an order of magnitude" can be slower. For instance, let us set a calculation that my Prime performs in 0,432 secs. Then my "other" calc does the same in "an order of 10 times the magnitude". So, in 0,432 secs it has performed 0,000226379693794 of the work that my Prime has done.. Wink (0,432^10=~2,26*10^-4)

Not quite. Smile

An order of magnitude. Or two orders of magnitude and so on.
When you say "an order of 10 times the magnitude" maybe you mean "ten orders of magnitude".

In this case it would be: 0.432 e10 or 0.432 x 10^10 .

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
12-28-2018, 09:42 PM
Post: #31
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
(12-28-2018 09:18 PM)pier4r Wrote:  
(12-28-2018 09:09 PM)DA74254 Wrote:  Which means that "an order of magnitude" can be slower. For instance, let us set a calculation that my Prime performs in 0,432 secs. Then my "other" calc does the same in "an order of 10 times the magnitude". So, in 0,432 secs it has performed 0,000226379693794 of the work that my Prime has done.. Wink (0,432^10=~2,26*10^-4)

Not quite. Smile

An order of magnitude. Or two orders of magnitude and so on.
When you say "an order of 10 times the magnitude" maybe you mean "ten orders of magnitude".

In this case it would be: 0.432 e10 or 0.432 x 10^10 .
Yes, that was my first approach. But I wanted it to be "orders of ten" smaller, thus my approach. Anyway, "orders of magnitude" is an arbitrary and very unaccurate measure since one does not know which direction it goes and/or which "magnitude" one chooses. Stars are x^~2,512 decimal are x^10 and binary are x^2 and so on. Then again "zero point.." will always be less in any orders of magnitude unless the magnitude is negative.

Esben
15C CE, 28s, 35s, 49G+, 50G, Prime G2 HW D, SwissMicros DM32, DM42, DM42n, WP43 Pilot
Elektronika MK-52 & MK-61
Find all posts by this user
Quote this message in a reply
12-28-2018, 11:50 PM
Post: #32
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
(12-28-2018 08:20 PM)DA74254 Wrote:  
(12-28-2018 02:58 PM)Stevetuc Wrote:  Here the Prime G2 is an order of magnitude faster than CG50 MicroPython.
The astronomer (and the rebellion) in me always comes to a hiccup when this particular term comes up.
Does anyone actually know what "one order of magnitude" really means? Wink
One order of magnitude is the 5th root of 100 or ca 2,511886431509580111085032067799328 (according to my DM42)
Astronomically, stars are odered by brightness in magnitudes.
A magnitude 6 star is the faintest one (normally) can see with the naked eye in a lightunpolluted sky. A magnitude 1 star is 100 times brighter. Each magnitude is determined by ~2,512^x where x starts with 0 at mag. 6 (2,512^0=1) and 5 (2,512^5=~100) at mag. 1. So, a mag. 6 star is "1" bright and a mag 1 star is "100" bright.

Star magnitudes

(Post should be taken as Wink )

Yes, and a continous merry christmas and a coming prosperous new year to all.

You got me! I did forget to mention that I meant the commonly used definition of10^n and not the astronomical definition Smile

The Cambridge dictionary says:
Meaning of “order of magnitude” in the English Dictionary
A level in a system used for measuring something in which each level is ten times larger than the one before:

Eg. These processor speeds have recently increased by two ordersof magnitude (= by a hundred times).

Just saying..
Find all posts by this user
Quote this message in a reply
12-29-2018, 11:08 PM (This post was last modified: 12-29-2018 11:10 PM by gomefun2.)
Post: #33
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
I tried those benchmarks on both my HP-35s and my dm42.

What's going on?

4:17 HP-35S Keystroke / RPN

My HP-35s can do this in well under 20 seconds. How do they report a time of 4 minutes and 17 seconds?

4.18 DM-42 Keystroke / RPN

My dm-42 gets an answer in under 1 second on battery and even faster when plugged in.

Both of my calculators seem to be much faster than the reported times.

Also, they both get an answer of 8 in the Y-reg and an answer of 36 in the X-reg.

I just copied the corresponding program into the calculator that was listed on the site.

I'm referring to:

http://www.hpmuseum.org/cgi-sys/cgiwrap/...i?read=700
Find all posts by this user
Quote this message in a reply
12-30-2018, 01:28 AM
Post: #34
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
(12-29-2018 11:08 PM)gomefun2 Wrote:  I tried those benchmarks on both my HP-35s and my dm42.
... snip ...
4.18 DM-42 Keystroke / RPN

My dm-42 gets an answer in under 1 second on battery and even faster when plugged in.

Both of my calculators seem to be much faster than the reported times.

Also, they both get an answer of 8 in the Y-reg and an answer of 36 in the X-reg.

I just copied the corresponding program into the calculator that was listed on the site.

I'm referring to:

http://www.hpmuseum.org/cgi-sys/cgiwrap/...i?read=700

Using the program listed for the DM42 on the linked page, my DM42 gets about the same time as listed there (between 4-5 secs) on battery power, and about 2 secs with USB plugged in.

The correct results should be 876 (not 36) so there is probably an error (maybe a skipped line) in the code you entered.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
12-30-2018, 11:48 AM (This post was last modified: 12-30-2018 12:01 PM by gomefun2.)
Post: #35
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
what is this key:

"x<>y?"

I can't find it on my HP35s, DM42 or wp34s...

All three of my calculators give the same incorrect answer. I think it has to do with this key.

I can find the x<>y key. That just swaps the x-reg and y-reg.

EDIT: I assume it means !=
(does not equal)

But I still don't get the correct answer.

EDIT: Hmm actually I got it to work on the wp-34s, I'll go back and check the other two.
Find all posts by this user
Quote this message in a reply
12-30-2018, 02:34 PM
Post: #36
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
(12-30-2018 11:48 AM)gomefun2 Wrote:  EDIT: I assume it means !=
(does not equal)

Yes, that's correct. The program as listed is for older machines, so some of the instructions may not look exactly the same as on the 35S or 42S, though except for the one you noted, they all seem clear to me; ask about them if they don't seem clear.

When programs are listed the way they are on that page (i.e. not using 1 instruction per line) it is easy to miss an instruction, particularly when many are similar as is the case for this program.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
12-30-2018, 05:07 PM (This post was last modified: 12-30-2018 05:20 PM by Dieter.)
Post: #37
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
(12-30-2018 11:48 AM)gomefun2 Wrote:  what is this key:

"x<>y?"

I can't find it on my HP35s, DM42 or wp34s...

That's the x≠y? test.

Since "≠" is not an ASCII character this is written as "<>" in various programming languages and similar environments.

(12-30-2018 11:48 AM)gomefun2 Wrote:  All three of my calculators give the same incorrect answer. I think it has to do with this key.
...
EDIT: I assume it means !=
(does not equal)

But I still don't get the correct answer.

Most probably you got an incorrect program with one or more errors. Since the 35s program on the mentioned benchmark page is merely 40 lines, what about posting your (!) 35s program here? The errors should be easy to spot.

For example: STO (I) and STO (J) are different from STO I and STO J.
The same is true for DSE (I) and DSE I, all these are different commands.

Just to be sure: on the 35s please do a manual CLVARX 000 before you run the program.
The 35s code has a CLVARS command, but this does not clear the extended registers where the program stores its data!

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 4 Guest(s)