testing sorters and memory allocation

Learning computers at this stage, I've always been the type of person to question things.

Our lesson in class is to test our bubble sort, merge sort, and quick sort with a pytest module called cProfile.  My results are spectacularly slow, as expected, but the really odd thing is that my bubble sort is about the same speed as merge sort,  and my quick sort is exceedingly slower then both on a random number list of size 800.

After all the tests I ran on my computer involving randint, and the timeit(), I think I have a new theory about these sorts.

Because my memory is so low, the two sorts that are storing to memory to sort out the Doubly Linked List, (merge sort, quick sort)  are spilling into my hard drive, and the retrieval of those pieces are making the sort take an even longer time then it should.

I asked in my class discussion board if it's worth looking into, because I think with the kind of advanced systems they use for databases this would never be an issue for anyone other then myself on a personal computer like Hal.  Answer: It would be extremely hard to analyse with Python, but it is a huge part of how those data structures operate.

I get why bubble sort is slow, and I can see how the merge sort and quick sort are the faster options,  But is it really ok that they rely so heavily on transporting data back and forth through the memory so much?

Probably over-thinking it.  Not sure how I'm going to proceed through the lessons when my results are the opposite of what they should be to tune performance.  If I'm tuning performance on my machine,  relying on memory would be the worst thing to do.

Maybe that's my route to an original idea.  How to sort data without relying on storing data to memory to do it.  I have a feeling it's already been done, or just over my head, but.... once again.  Why not?

Time to google. 

Comments

Popular posts from this blog

playing with color in powershell python

JavaScript Ascii animation with while loops and console.log

playing with trigonometry sin in pygame