Post Reply 
Programming puzzles: processing lists!
06-14-2017, 05:40 AM
Post: #151
RE: Programming puzzles: processing lists!
(06-13-2017 06:23 PM)DavidM Wrote:  I'll recreate the list by copying the two blocks of memory containing the reversed parts into a new list object directly. It will require a bit more setup (and a lot more code), but it should be a relatively fast option that is nicer to the overall memory footprint of the machine.

First stab at the new version of LROT (LROT7 below) is promising:

\begin{array}{|lrrrrc|}
\hline
\textbf{Command} & \textbf{50} & \textbf{100} & \textbf{500} & \textbf{1000} & \textbf{Cycles} \\
\hline
\textbf{LROT} & 0.0259 & 0.0339 & 0.1006 & 0.1820 & 50 \\
\textbf{LROT7} & 0.0262 & 0.0299 & 0.0592 & 0.0945 & 50 \\
\hline
\end{array}

Timings are comparable to the original for smaller lists, but it scales nicely as the list sizes grow. And it's much nicer with regards to the memory footprint, in that it doesn't explode the list and rebuild it. Completed the 1000-element "stress test" (1000 loops with DUP/HEAD/etc.) in about 125 seconds.
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-14-2017 05:40 AM



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