diff options
author | Tim Peters <tim.peters@gmail.com> | 2002-08-03 09:56:52 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2002-08-03 09:56:52 (GMT) |
commit | 657fe38241a7f072bdbf040a7bd05df96f326c5c (patch) | |
tree | 1cea4e21c0bb515702af1cd180ff350cfc1b9ebf /Python/compile.c | |
parent | 6bdbc9e0b1d17e637236dc71b3fa775c23dd1d40 (diff) | |
download | cpython-657fe38241a7f072bdbf040a7bd05df96f326c5c.zip cpython-657fe38241a7f072bdbf040a7bd05df96f326c5c.tar.gz cpython-657fe38241a7f072bdbf040a7bd05df96f326c5c.tar.bz2 |
Large code rearrangement to use better algorithms, in the sense of needing
substantially fewer array-element compares. This is best practice as of
Kntuh Volume 3 Ed 2, and the code is actually simpler this way (although
the key idea may be counter-intuitive at first glance! breaking out of
a loop early loses when it costs more to try to get out early than getting
out early saves).
Also added a comment block explaining the difference and giving some real
counts; demonstrating that heapify() is more efficient than repeated
heappush(); and emphasizing the obvious point thatlist.sort() is more
efficient if what you really want to do is sort.
Diffstat (limited to 'Python/compile.c')
0 files changed, 0 insertions, 0 deletions