Search found 4 matches
- Thu Jun 21, 2012 6:46 am
- Forum: Common Lisp
- Topic: Lisp newbie trying to optimize recursive algorithm, help?
- Replies: 16
- Views: 37197
Re: Lisp newbie trying to optimize recursive algorithm, help
I tested your heavily optimized array version count-inversions-6 on my PC and it still takes more than twice the time than the OPs version without a funcalled predicate (0.562 seconds vs 0.205 seconds). Maybe its just my hardware (Intel Pentium Dual-Core E5300 @ 2.60GHz) but all the arrays and decl...
- Wed Jun 20, 2012 6:06 am
- Forum: Common Lisp
- Topic: Lisp newbie trying to optimize recursive algorithm, help?
- Replies: 16
- Views: 37197
Re: Lisp newbie trying to optimize recursive algorithm, help
Thanks for the replies guys. Moving from a list to an array didn't quite have the impact I was expecting, maybe 10% off the running. Taking out the funcall to a predicate on the other hand made all the difference. It brings the running time down to 25 seconds, a huge speed up. So, does this mean tha...
- Tue Jun 19, 2012 1:46 am
- Forum: Common Lisp
- Topic: Lisp newbie trying to optimize recursive algorithm, help?
- Replies: 16
- Views: 37197
Re: Lisp newbie trying to optimize recursive algorithm, help
Thanks wvxvw. I think that you're right. I hadn't appreciated the difference between a lisp list and an array. I'll modify my code to work on an integer array (for starters) and see what sort of improvement that yields. I'm guessing that it will be significant. Is there any simple method to convert ...
- Mon Jun 18, 2012 2:01 pm
- Forum: Common Lisp
- Topic: Lisp newbie trying to optimize recursive algorithm, help?
- Replies: 16
- Views: 37197
Lisp newbie trying to optimize recursive algorithm, help?
Hi I've written an algorithm to count the number of inversions in a list of integers (pairs of integers that are out of order), but it runs very slowly. It takes ~400 seconds to run on a list of 100,000 integers. In contrast, the same algorithm written in Java runs in less than a second. The algorit...