Overview
| Artifact ID: | 485aba27a071abc10d6f747725c00c50bd310d8a |
|---|---|
| Ticket: | 735388ffffffffffffffffffffffffffffffffff
freeing lists takes nonlinear time |
| User & Date: | jenglish on 2004-02-21 08:15:24 |
Changes
- icomment:
Logged In: YES user_id=68433 This behaviour is symptomatic of all reference-counting memory management schemes. As long as the working set fits in available RAM, everything is fine; but when you're freeing a large number of blocks each call to Tcl_DecrRefCount() may potentially cause a page fault. Locality of reference plays a large part too -- freeing 100 Tcl_Obj's in a row is very quick if they happen to be in the same cache line, expensive if they happen to be in different ones (and *very* expensive if they're paged out in different pages). FWIW, on my Fast Overpowered machine, (dual 1.6 Mhz Athlon, 256K cache, ~1Gb RAM), the above test takes ~0.8 us/item all the way up to 900000 items; while on my Slightly Wimpy machine (400 Mhz PIII, 60 Mb RAM) I get the following: listsize = 100000 2.71754 us/item listsize = 200000 2.62894 us/item listsize = 300000 10.7855933333 us/item listsize = 400000 49.1984825 us/item listsize = 500000 45.585162 us/item listsize = 600000 61.9319466667 us/item listsize = 700000 67.7324 us/item listsize = 800000 77.3131225 us/item listsize = 900000 79.3220922222 us/item Note that the time is relatively constant for the first two iterations, jumps sharply, then stays relatively constant. Watching a 'gkrellm' monitor, the jump occurred almost exactly at the time the RAM meter pegged out. This has more to do with your CPU and cache size and how many other processes are active on the system than it does with glibc.
- login: "jenglish"
- mimetype: "text/plain"
- username: "jenglish"