diff options
author | Tim Peters <tim.peters@gmail.com> | 2002-07-08 06:32:09 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2002-07-08 06:32:09 (GMT) |
commit | 755ebea23b8bac26661d3315ef68ccff61c55e6e (patch) | |
tree | e90a7c4ca920e169a7e3412d2986fadf1306a283 /Mac/Include | |
parent | 059ed83cc327d8f9404a160b7a5f9fb2c2b5b090 (diff) | |
download | cpython-755ebea23b8bac26661d3315ef68ccff61c55e6e.zip cpython-755ebea23b8bac26661d3315ef68ccff61c55e6e.tar.gz cpython-755ebea23b8bac26661d3315ef68ccff61c55e6e.tar.bz2 |
PyNode_AddChild(): Do aggressive over-allocation when the number of
children gets large, to avoid severe platform realloc() degeneration
in extreme cases (like test_longexp).
Bugfix candidate.
This was doing extremely timid over-allocation, just rounding up to the
nearest multiple of 3. Now so long as the number of children is <= 128,
it rounds up to a multiple of 4 but via a much faster method. When the
number of children exceeds 128, though, and more space is needed, it
doubles the capacity. This is aggressive over-allocation.
SF patch <http://www.python.org/sf/578297> has Andrew MacIntyre using
PyMalloc in the parser to overcome platform malloc problems in
test_longexp on OS/2 EMX. Jack Jansen notes there that it didn't help
him on the Mac, because the Mac has problems with frequent ever-growing
reallocs, not just with gazillions of teensy mallocs. Win98 has no
visible problems with test_longexp, but I tried boosting the test-case
size and soon got "senseless" MemoryErrors out of it, and soon after
crashed the OS: as I've seen in many other contexts before, while the
Win98 realloc remains zippy in bad cases, it leads to extreme
fragmentation of user address space, to the point that the OS barfs.
I don't yet know whether this fixes Jack's Mac problems, but it does cure
Win98's problems when boosting the test case size. It also speeds
test_longexp in its unaltered state.
Diffstat (limited to 'Mac/Include')
0 files changed, 0 insertions, 0 deletions