Post Reply 
Little explorations with HP calculators (no Prime)
10-22-2017, 11:05 PM
Post: #240
RE: Little explorations with HP calculators (no Prime)
(10-22-2017 03:51 PM)pier4r Wrote:  generating 1000 values in a list with the SIN function takes time.
if, after every value, one stores it in a list with STO+
it takes around 600 seconds.

Adding elements to a list one by one is very inefficient and causes a lot of garbage collection. It is much faster to accumulate the elements on the stack, then combine them into a list like so:

Code:
\<< 1. 1000. FOR j j SIN
             NEXT 1000. \->LIST
\>>

which takes about 12.2 seconds on my 50g.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Little explorations with HP calculators (no Prime) - John Keith - 10-22-2017 11:05 PM



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