python-hyper / hpack

HTTP/2 Header Encoding for Python
https://hpack.readthedocs.io/en/latest/
MIT License
72 stars 32 forks source link

Benchmarks fail to run #82

Closed thedrow closed 7 years ago

thedrow commented 7 years ago
pytest test_hpack.py
============================================================================================================ test session starts =============================================================================================================
platform darwin -- Python 2.7.12[pypy-5.6.0-final], pytest-3.0.5, py-1.4.31, pluggy-0.4.0
benchmark: 3.0.0 (defaults: timer=time.time disable_gc=False min_rounds=5 min_time=5.00us max_time=1.00s calibration_precision=10 warmup=True warmup_iterations=100000)
rootdir: /Users/omer.katz/Documents/hpack, inifile:
plugins: benchmark-3.0.0, hypothesis-3.6.0
collected 8 items

test_hpack.py ....FFFF

---------------------------------------------------------------------------------------------- benchmark: 4 tests ---------------------------------------------------------------------------------------------
Name (time in ns)                               Min                       Max                  Mean                 StdDev                Median                 IQR            Outliers(*)  Rounds  Iterations
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_encode_small_integer_large_prefix     338.5544 (1.0)         17,421.2456 (1.15)       415.9126 (1.0)         233.3873 (1.0)        369.5488 (1.0)       30.9944 (1.0)        1800;4739   29538         100
test_encode_small_integer_small_prefix     379.0855 (1.12)        15,089.5119 (1.0)        610.6153 (1.47)        322.5013 (1.38)       441.0744 (1.19)     360.0121 (11.62)       3102;591   23832         100
test_encode_large_integer_large_prefix     488.7581 (1.44)     3,707,301.6167 (245.69)     865.5497 (2.08)     12,348.6403 (52.91)      596.0464 (1.61)     143.0511 (4.62)       154;17795  102301          20
test_encode_large_integer_small_prefix     488.7581 (1.44)     3,435,206.4133 (227.66)   2,284.0136 (5.49)     25,836.0621 (110.70)   1,096.7255 (2.97)     154.9721 (5.00)       709;25009  102301          20
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(*) Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
================================================================================================================== FAILURES ==================================================================================================================
_________________________________________________________________________________ TestHpackDecodingIntegersBenchmarks.test_decode_small_integer_large_prefix _________________________________________________________________________________

self = <test_hpack.TestHpackDecodingIntegersBenchmarks instance at 0x000000010630e5e0>, benchmark = <pytest_benchmark.plugin.BenchmarkFixture object at 0x000000010627fc20>

    def test_decode_small_integer_large_prefix(self, benchmark):
        data = encode_integer(integer=120, prefix_bits=7)
>       benchmark(decode_integer, data=data, prefix_bits=7)

test_hpack.py:24:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.virtualenvs/hpack/site-packages/pytest_benchmark/plugin.py:349: in __call__
    return self._raw(function_to_benchmark, *args, **kwargs)
../../../.virtualenvs/hpack/site-packages/pytest_benchmark/plugin.py:371: in _raw
    duration, iterations, loops_range = self._calibrate_timer(runner)
../../../.virtualenvs/hpack/site-packages/pytest_benchmark/plugin.py:482: in _calibrate_timer
    duration = runner(loops_range)
../../../.virtualenvs/hpack/site-packages/pytest_benchmark/plugin.py:315: in runner
    function_to_benchmark(*args, **kwargs)
../hpack/hpack.py:107: in decode_integer
    number = to_byte(data[0]) & mask
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

char = 120

    def to_byte(char):
>       return ord(char)
E       TypeError: ord() expected string of length 1, but int found

../hpack/compat.py:17: TypeError
_________________________________________________________________________________ TestHpackDecodingIntegersBenchmarks.test_decode_small_integer_small_prefix _________________________________________________________________________________

self = <test_hpack.TestHpackDecodingIntegersBenchmarks instance at 0x00000001071801e0>, benchmark = <pytest_benchmark.plugin.BenchmarkFixture object at 0x0000000107184138>

    def test_decode_small_integer_small_prefix(self, benchmark):
        data = encode_integer(integer=120, prefix_bits=1)
>       benchmark(decode_integer, data=data, prefix_bits=1)

test_hpack.py:28:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.virtualenvs/hpack/site-packages/pytest_benchmark/plugin.py:349: in __call__
    return self._raw(function_to_benchmark, *args, **kwargs)
../../../.virtualenvs/hpack/site-packages/pytest_benchmark/plugin.py:371: in _raw
    duration, iterations, loops_range = self._calibrate_timer(runner)
../../../.virtualenvs/hpack/site-packages/pytest_benchmark/plugin.py:482: in _calibrate_timer
    duration = runner(loops_range)
../../../.virtualenvs/hpack/site-packages/pytest_benchmark/plugin.py:315: in runner
    function_to_benchmark(*args, **kwargs)
../hpack/hpack.py:107: in decode_integer
    number = to_byte(data[0]) & mask
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

char = 1

    def to_byte(char):
>       return ord(char)
E       TypeError: ord() expected string of length 1, but int found

../hpack/compat.py:17: TypeError
_________________________________________________________________________________ TestHpackDecodingIntegersBenchmarks.test_decode_large_integer_large_prefix _________________________________________________________________________________

self = <test_hpack.TestHpackDecodingIntegersBenchmarks instance at 0x0000000105c1bf60>, benchmark = <pytest_benchmark.plugin.BenchmarkFixture object at 0x0000000106f11e50>

    def test_decode_large_integer_large_prefix(self, benchmark):
        data = encode_integer(integer=120000, prefix_bits=7)
>       benchmark(decode_integer, data=data, prefix_bits=7)

test_hpack.py:32:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.virtualenvs/hpack/site-packages/pytest_benchmark/plugin.py:349: in __call__
    return self._raw(function_to_benchmark, *args, **kwargs)
../../../.virtualenvs/hpack/site-packages/pytest_benchmark/plugin.py:371: in _raw
    duration, iterations, loops_range = self._calibrate_timer(runner)
../../../.virtualenvs/hpack/site-packages/pytest_benchmark/plugin.py:482: in _calibrate_timer
    duration = runner(loops_range)
../../../.virtualenvs/hpack/site-packages/pytest_benchmark/plugin.py:315: in runner
    function_to_benchmark(*args, **kwargs)
../hpack/hpack.py:107: in decode_integer
    number = to_byte(data[0]) & mask
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

char = 127

    def to_byte(char):
>       return ord(char)
E       TypeError: ord() expected string of length 1, but int found

../hpack/compat.py:17: TypeError
_________________________________________________________________________________ TestHpackDecodingIntegersBenchmarks.test_decode_large_integer_small_prefix _________________________________________________________________________________

self = <test_hpack.TestHpackDecodingIntegersBenchmarks instance at 0x0000000107b5c9e0>, benchmark = <pytest_benchmark.plugin.BenchmarkFixture object at 0x0000000107b80640>

    def test_decode_large_integer_small_prefix(self, benchmark):
        data = encode_integer(integer=120000, prefix_bits=1)
>       benchmark(decode_integer, data=data, prefix_bits=1)

test_hpack.py:36:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.virtualenvs/hpack/site-packages/pytest_benchmark/plugin.py:349: in __call__
    return self._raw(function_to_benchmark, *args, **kwargs)
../../../.virtualenvs/hpack/site-packages/pytest_benchmark/plugin.py:371: in _raw
    duration, iterations, loops_range = self._calibrate_timer(runner)
../../../.virtualenvs/hpack/site-packages/pytest_benchmark/plugin.py:482: in _calibrate_timer
    duration = runner(loops_range)
../../../.virtualenvs/hpack/site-packages/pytest_benchmark/plugin.py:315: in runner
    function_to_benchmark(*args, **kwargs)
../hpack/hpack.py:107: in decode_integer
    number = to_byte(data[0]) & mask
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

char = 1

    def to_byte(char):
>       return ord(char)
E       TypeError: ord() expected string of length 1, but int found

../hpack/compat.py:17: TypeError
Lukasa commented 7 years ago

See #83.