Programming puzzles: processing lists!
|
02-14-2019, 05:01 PM
Post: #273
|
|||
|
|||
RE: Programming puzzles: processing lists!
On the subject of slow up list operations, there are a couple of ways of speeding up programs where items are appended to an existing list.
One is to store the list in a global (not local) variable. This prevents the system having to save a copy of the original list after every operation. The best way is to not append items to an existing list in the first place. If there is a way to accumulate the items on the stack and then assemble them into a list using \->LIST that is the fastest way. For example, to create a list of 1000 RANDs: Slow program: Code:
Fast program: Code:
Of course there are programs where the items must be in a list because intermediate list processing operations need to be performed. Unfortunately using arrays instead of lists will usually not be helpful in these cases. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)