PDA

View Full Version : oooh how much fun recursion is...



DavidP
03-05-2004, 05:54 PM
So I was doing this project for school which requires a lot of recursion (and i mean a lot). Some test files take up to 20 minutes to complete because of how much recursion is involved. (Right now we are purposely coding it with lots of recursion, and soon we will optimize our programs).

Well, I was testing my program on a test file, and it was taking ages to complete. So I decided I wanted to know exactly how much memory my program was taking up.

I had SSH'd into a Linux machine from my Windows machine, and so the program was actually running on the Linux machine and not mine, although I was watching it from my machine.

So I walked down the hall to the Linux lab at my school and logged onto the machine that I was SSH'd to from the Windows lab. I then proceeded to check the system stats.

CPU usage was at 100%.
Swap file usage was increasing at 1 MB per second on average.
Memory usage was at 746 MB out of 754 MB total.

So then I decided to go cut execution of my program from my Windows machine and come back and check the new system stats. When I came back system stats were:

CPU usage was at 3%
Swap file usage was down from 221 MB to 34 MB and staying steady.
Memory usage was down to 134 MB and staying steady.

The funny thing is my program wasnt running infinitely...it was actually solving the problem and DOES end if you let it run long enough.

Lurker
03-05-2004, 06:05 PM
Wheeeeeeeeee.