Post Reply 
Programming puzzles: processing lists!
06-13-2017, 12:43 AM
Post: #146
RE: Programming puzzles: processing lists!
(06-12-2017 10:26 PM)pier4r Wrote:  The test with lists of 1000 elements is still running, over an hour now.

I'll be interested in the restults.

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 }

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.

Garbage Collections can be made worse by using certain techniques, though I must confess the reasons aren't always obvious. It could be that simply splitting a large list into two sublists is one of those techniques that causes problems. It doesn't make sense to me that it would be any worse than exploding everything then imploding it back, but the evidence speaks for itself!

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.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Programming puzzles: processing lists! - DavidM - 06-13-2017 12:43 AM



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