• Damien George's avatar
    py: Improve encoding scheme for line-number to bytecode map. · 4747becc
    Damien George authored
    Reduces by about a factor of 10 on average the amount of RAM needed to
    store the line-number to bytecode map in the bytecode prelude.
    Using CPython3.4's stdlib for statistics: previously, an average of
    13 bytes were used per (bytecode offset, line-number offset) pair, and
    now with this improvement, that's down to 1.3 bytes on average.
    Large RAM usage before was due to some very large steps in line numbers,
    both from the start of the first line in a function way down in the
    file, and also functions that have big comments and/or big strings in
    them (both cases were significant).
    Although the savings are large on average for the CPython stdlib, it
    won't have such a big effect for small scripts used in embedded
    Addresses issue #648.