cpython/Parser
Tim Peters 755ebea23b 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.
2002-07-08 06:32:09 +00:00
..
.cvsignore Ignore a bunch of generated files. 2000-05-02 18:34:30 +00:00
acceler.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
bitset.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
firstsets.c Silence parser generator output. 2001-09-11 16:43:16 +00:00
grammar.c The parser doesn't need its own implementation of assert, and having its 2001-12-04 03:18:48 +00:00
grammar.mak Link with the right C library! This has always been wrong (& my fault). 2002-05-23 19:25:59 +00:00
grammar1.c PyGrammar_LabelRepr(): sprintf -> PyOS_snprintf. 2001-12-04 03:36:01 +00:00
intrcheck.c Include <unistd.h> in Python.h. Fixes #500924. 2002-01-12 11:05:12 +00:00
listnode.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
metagrammar.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
myreadline.c RISCOS changes by dschwertberger. 2001-03-02 06:34:14 +00:00
node.c PyNode_AddChild(): Do aggressive over-allocation when the number of 2002-07-08 06:32:09 +00:00
parser.c Disable the parser hacks that allowed the "yield" keyword to be enabled 2002-03-22 23:38:11 +00:00
parser.h Disable the parser hacks that enabled the "yield" keyword using a future 2002-03-22 23:53:36 +00:00
parsetok.c Disable the parser hacks that enabled the "yield" keyword using a future 2002-03-22 23:53:36 +00:00
pgen.c Py_IgnoreEnvironmentFlag should be extern, since it is declared in pythonrun.c 2002-05-31 13:11:40 +00:00
pgen.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
pgenmain.c Add definition of Py_IgnoreEnvironmentFlag (needed at least in debug 2002-05-31 14:32:07 +00:00
printgrammar.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
tokenizer.c Mass checkin of universal newline support. 2002-04-14 20:12:41 +00:00
tokenizer.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00