Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display optimizations (between 2x00 and 8x00 times faster) (ignore, superseded by #160) #158

Closed
wants to merge 10 commits into from

Commits on Jun 17, 2022

  1. Upgrade pyperf (drop support for Python 2.x)

    Since 0.8.1 pyte does not support Python 2.x anymore so it makes sense
    to upgrade one of its dev dependencies, pyperf.
    eldipa committed Jun 17, 2022
    Configuration menu
    Copy the full SHA
    8513fe8 View commit details
    Browse the repository at this point in the history
  2. Allow change the screen geometry

    Receive via environ the geometry of the screen to test with a
    default of 24 lines by 80 columns.
    Add this and the input file into Runner's metadata so it is preserved in
    the log file (if any)
    eldipa committed Jun 17, 2022
    Configuration menu
    Copy the full SHA
    cabc0a5 View commit details
    Browse the repository at this point in the history
  3. Impl benchmark tests for screen.display, .reset and .resize

    Implement three more benchmark scenarios for testing screen.display,
    screen.reset and screen.resize.
    
    For the standard 24x80 geometry, these methods have a negligible cost
    however of larger geometries, they can be up to 100 times slower than
    stream.feed so benchmarking them is important.
    
    Changed how the metadata is stored so on each bench_func call we encode
    which scenario are we testing, with which screen class and geometry.
    eldipa committed Jun 17, 2022
    Configuration menu
    Copy the full SHA
    940e19b View commit details
    Browse the repository at this point in the history

Commits on Jun 18, 2022

  1. Impl script to run a full benchmark

    A shell script to test all the captured input files and run them
    under different terminal geometries (24x80, 240x800, 2400x8000, 24x8000
    and 2400x80).
    
    These settings aim to stress pyte with larger and larger screens (by a
    10 factor on both dimensions and on each dimension separately).
    eldipa committed Jun 18, 2022
    Configuration menu
    Copy the full SHA
    0b8007a View commit details
    Browse the repository at this point in the history

Commits on Jul 2, 2022

  1. Fix benchmark.py using ByteStream and not Stream

    The input files in the tests/captured must be loaded with ByteStream and
    not Stream, otherwise the \r are lost and the benchmark results may not
    reflect real scenarios.
    eldipa committed Jul 2, 2022
    Configuration menu
    Copy the full SHA
    e0b0e8b View commit details
    Browse the repository at this point in the history

Commits on Jul 4, 2022

  1. Configuration menu
    Copy the full SHA
    eec4a2e View commit details
    Browse the repository at this point in the history
  2. display meth: iterate over data entries filling the gap between

    The former `for x in range(...)` implementation iterated over the all
    the possibly indexes (for columns and lines) wasting cyclies because
    some of those indexes (and in some cases most) pointed to non-existing
    entries.
    
    These non-existing entries were faked and a default character was
    returned in place.
    
    This commit instead makes display to iterate over the existing entries.
    When gaps between to entries are detected, the gap is filled with the
    same default character without having to pay for indexing non-entries.
    
    Note: I found that in the current implementation of screen,
    screen.buffer may have entries (chars in a line) outside of the width of
    the screen. At the display method those are filtered out however I'm not
    sure if this is not a real bug that was uncovered because never we
    iterated over the data entries. If this is true, we may be wasting space
    as we keep in memory chars that are outside of the screen.
    eldipa committed Jul 4, 2022
    Configuration menu
    Copy the full SHA
    f899535 View commit details
    Browse the repository at this point in the history
  3. Inline generator into display inner loop

    Python generators (yield) and function calls are slower then normal
    for-loops. Improve screen.display by x1 to x1.8 times faster by
    inlining the code.
    eldipa committed Jul 4, 2022
    Configuration menu
    Copy the full SHA
    b3b7db4 View commit details
    Browse the repository at this point in the history
  4. Move assert out of prod code

    The assert that checks the width of each char is removed from
    screen.display and put it into the tests. This ensures that our test
    suite maintains the same quality and at the same time we make
    screen.display ~x1.7 faster.
    eldipa committed Jul 4, 2022
    Configuration menu
    Copy the full SHA
    de59245 View commit details
    Browse the repository at this point in the history
  5. Cache in Char its width

    Instead of computing it on each screen.display, compute the width of the
    char once on screen.draw and store it in the Char tuple.
    
    This makes screen.display ~x1.10 to ~x1.20 faster and it makes
    stream.feed only ~x1.01 slower in the worst case. This negative impact
    is due the change on screen.draw but measurements on my lab show
    inconsistent results (stream.feed didn't show a consistent performance
    regression and ~x1.01 slower was the worst value that I've got).
    eldipa committed Jul 4, 2022
    Configuration menu
    Copy the full SHA
    020fce6 View commit details
    Browse the repository at this point in the history