Post Reply 
Programming puzzles: processing lists!
06-13-2017, 08:23 AM
Post: #147
RE: Programming puzzles: processing lists!
(06-13-2017 12:43 AM)DavidM Wrote:  I ran a single cycle with 1000 list elements, and got these results:

"dosubs" { 7.8397 }
"dolist" { 7.7578 }
"for get" { 34.002 }
"start geti" { 54.728 }
"start headList" { 535.6086 }
"start tail head" { 33.1366 }
"start lrot" { 4244.4562 }

You saved me. The night is passed but the 50g is still working. Based on your measurements I would expect 13.5 hours for 10 cycles.

Impressive how headList dropped his efficiency and started to be not linear (so exploding a list does not help too) and impressive for + get. I remember now I tested it with 1000 elements and I was getting like 35 seconds. Even for it is not linear (one would expect 9 seconds, 10 times 0.9, not 35) but still only "5" times slower than the DOx commands. Also tail+head very quick.

Quote:The LROT loop is most likely a victim of multiple garbage collection events, as the expected time based on previous timings would have been closer to 385 seconds.

I'll continue to test some other methods for LROT. I may also "special case" it to use a roll/unroll if the argument is 1 or -1, since that would almost certainly be better than creating two lists to join when one of them has only one element.

Yes I guess special cases of an "handful" of elements rotated (I do not know a meaningful threshold, but maybe up to +10 , -10 ?) would make LROT really effective even for multiple calls.

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Programming puzzles: processing lists! - pier4r - 06-13-2017 08:23 AM



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