my garbage collector sucks
"Mark Hahn" <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
When I was testing the new WeakRef callback feature I set up a read notification callback on an object to print out "read". When I started the test my screen my screen started scrolling "read" as fast as it could. I quickly realized my garbage collector was scanning through all the objects reading them as it did it's mark-sweep algorithm. This was happening so fast my one test object was being read repeatedly. I "fixed" this by using a different read-lock routine in the garbage collector that doesn't trigger the notify feature. This gave me a graphic demonstration that my garbage collector is visiting all the objects all the time which is going to be hell on the cpu cache when I start to worry about performance. Even when I optimize the collector to run less often it will still have this obnoxious behaviour of visiting each object up the three times per cycle. Unless anyone can come up with any other ideas I will go to the Python reference counter scheme, even though I hate having to keep track of the reference count in my C code. Someone please save me! At the rate I'm going I'm going to end up reinventing Python! Seriously though, finding out which parts of Python are really needed and which parts aren't by trying the hard way is not such a bad idea. When we are finished with this process we will be confident we have the correct choice for each decision.