google / emboss

Emboss is a tool for generating code that reads and writes binary data structures.
Apache License 2.0
67 stars 20 forks source link

Improve perf of `_call_with_optional_args` #120

Closed EricRahm closed 3 months ago

EricRahm commented 3 months ago

Fixes issue #119.

  1. In preparation for a perf improvement all actions that use lambdas are converted to static functions. Additionally duplicate actions are removed.
  2. The results of getfullargspec are memoized and encapsulated in a helper class.

This gets us from 100K calls to getfullargspec to about 60 and reduces overhead from 10% to ~0% in my tests.