Programming puzzles: processing lists!
|
06-12-2017, 07:46 PM
(This post was last modified: 06-13-2017 10:24 AM by pier4r.)
Post: #141
|
|||
|
|||
RE: Programming puzzles: processing lists!
Neat addition. And yes the revlist works.
So I got some surprising experiences. First the FOR is not as slow as I though compared to DOSUBS / DOLIST (I though was like 10 times slower). 10 times iterating over a list of 100 elements. dosusbs: avg 0.48 s dolist: avg 0.50 s for get: avg 0.93 s (nice pun) start geti: avg 1.19 s start headList: avg 0.42 s (surprise! same speed category of dosusbs/dolist) . wrong, the code had a bug. start headList: avg 1.66 s start DUP TAIL SWAP HEAD: avg 0.96 s start lrot: avg 3.50 s (I had hopes on this, but likely rotating a list is not that easy) So if exploding a list with userRPL gets a speed (maybe only for 100 elements, I need to test with 1000) comparable to dolist/dosubs and way better than the compact TAIL + HEAD (those may be few commands but I beleive are intensive), I was thinking that exploding the list and handling it with sysRPL would be super fast, like 3 times faster. Also I was thinking that LROT would have been faster, maybe is the DUP + HEAD operations that makes it slow. if the "headTail" procedure holds its speed, it is a great replacement for dosubs/dolists for iterations, at least in userRPL. Also using a for is not as bad as I thought. Going for 1000 elements now. Of course, if you see other ways (debug friendly) to iterate over a list, please tell me! Code:
Wikis are great, Contribute :) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)