HHC 2014 Programming Contest
|
09-29-2014, 11:35 AM
Post: #25
|
|||
|
|||
RE: HHC 2014 Programming Contest
(09-29-2014 11:13 AM)Neil Hamilton Wrote: I am also wondering why the performance dropped to ~1.25 s/yr when run against a set with an ~8400 year span. The only thing I can think of is that since I push my answers to the stack and with 1000-odd entries on the stack, that might be slowing it down.The large date span probably means that the calculator would do garbage collection at least one, and the items on the large number of items on the stack would make it slow. On the other hand, putting the items in a list would probably be even worse. When you add to a list, it actually creates a new list and copies the old and new items into it. Adding the 877th item copies 866 items, and the new one. So that would probably be even slower. Try dropping the items into a pre-sized array. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 12 Guest(s)