thriftrw / thriftrw-python

A Thrift encoding library for Python
MIT License
36 stars 10 forks source link

Add validation optimization. #137

Closed clin88 closed 7 years ago

clin88 commented 8 years ago

Avoid recursively validating child structs and unions since they've already been validated at construction.

This halves the time spent in the binary_loads[nested_structs] benchmark.

before


---------------------------------------------------------------------- benchmark: 8 tests ---------------------------------------------------------------------
Name (time in us)                                      Min           Max          Mean       StdDev        Median          IQR  Outliers(*)  Rounds  Iterations
---------------------------------------------------------------------------------------------------------------------------------------------------------------
test_binary_loads[nested_structs]              10,451.0784   28,539.8960   15,334.3511   4,715.4690   13,751.0300   6,932.0202         19;0      86           1

after

--------------------------------------------------------------------- benchmark: 7 tests ---------------------------------------------------------------------
Name (time in us)                                      Min           Max          Mean      StdDev        Median          IQR  Outliers(*)  Rounds  Iterations
--------------------------------------------------------------------------------------------------------------------------------------------------------------
test_binary_loads[nested_structs]               7,688.0455   24,724.9603    8,397.0852  2,537.6019    7,873.0583     171.2441         5;15     125           1
coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.2%) to 75.017% when pulling cf6b6c14e51f850760cc41cde7da456736821698 on validation-opt into d85c808f385b17a24273ba7f9a0d246c39588874 on streaming-read.

coveralls commented 8 years ago

Coverage Status

Changes Unknown when pulling 1dd5c5b27904c5109d22cfb37b417a2d0e703d80 on validation-opt into on streaming-read.

coveralls commented 8 years ago

Coverage Status

Changes Unknown when pulling 1dd5c5b27904c5109d22cfb37b417a2d0e703d80 on validation-opt into on streaming-read.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.09%) to 74.245% when pulling 1dd5c5b27904c5109d22cfb37b417a2d0e703d80 on validation-opt into bf9b4a729d95608dee80c7c758545e38b2a30f00 on streaming-read.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.09%) to 74.245% when pulling fc39ba50b65237926c6ace4f6d31b3ad843e5a8f on validation-opt into fd0eb6efbb5159b1a81e03346184b6b1d8389da5 on streaming-read.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.05%) to 74.211% when pulling 2552b96a78af0e8ed4f0b4d53eecb6607151ea2e on validation-opt into fd0eb6efbb5159b1a81e03346184b6b1d8389da5 on streaming-read.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.05%) to 74.211% when pulling 22a374286f5dde15b614cce1d0446cf648789c97 on validation-opt into fd0eb6efbb5159b1a81e03346184b6b1d8389da5 on streaming-read.