Calculator Community > HP Calculators
More HP Prime performance tests: Circles, Int and Random
DJ Omnimaga:
Anyone has any clue why the INT command is slowish? I made a program that draws 256 circles per loop, with three random commands (for the colors). Thinking that RGB didn't support decimals, I decided to use INT(). However, I got 1.5 images per second. I thought this wasn't that bad considering the three RANDOM commands, but when I removed the INT commands to see if RGB supported decimals, not only the program still worked, but now I can no longer count the frames per second I get. O.O
--- Code: ---EXPORT CIRCLE()
BEGIN
DIMGROB_P(G1,320,240,RGB(0,0,0));
WHILE 1 DO
FOR A FROM 1 TO 255 DO
ARC_P(G1,160,120,A,RGB(255*RANDOM,255*RANDOM,255*RANDOM));
END;
BLIT_P(G0,G1);
END;
END;
--- End code ---
Not that I am complaining, but I was wondering why the INT command had more of an impact on speed than RANDOM, considering on the 84+ it was the opposite?
XiiDraco:
Good Question. Maybe you could ask HP sometime :P. And It might not be the same considering it is an HP and not a Texas Instruments.
I still need to figure out how to use draw commands efficiently, and I would love to know how to use the lists too. Then I could start using the touchscreen.
Ryleh:
My guess would be that it is an OS-related issue and that it isn't properly utilizing the hardware.
timwessman:
INT is a cas command (which isn't even supposed to be in there actually as it conflicts with "int" the integration command). IP (integer part) is what you are looking for I suspect. That might make a "small" difference...
RANDOM(255) would also give you the same thing there and be sightly quicker.
Basically, any input that requires a number will correctly pull from reals, integers, or complexes.
DJ Omnimaga:
Oh ok I was used to TI's int() command, which removes the decimal part from a number to create an integer. TI calcs also got IPart but I forgot the difference between Int() and IPart().
Also thanks for the RANDOM advice.
Navigation
[0] Message Index
[#] Next page
Go to full version