thedeemon:

Your program should get quadratically slower.
If you just allocate in a loop, GC is called O(n) times and each time it scans all the heap, each scan is O(n), so you get O(n^2) overall time.

This was a very well know problem with the simple GC of CPython, so about two or three years ago they have added an optimization: if the GC finds many nearby allocations, it switches off, to go back to a more linear run-time.

I vaguely remember someone talking about a similar optimization in the D GC, but even if it's there, it's not working well enough.

Bye,
bearophile

Reply via email to