mverleg / pyjson_tricks

Extra features for Python's JSON: comments, order, numpy, pandas, datetimes, and many more! Simple but customizable.
Other
154 stars 23 forks source link

Optimize kwargs filter for less calls to signature() #56

Closed janLo closed 5 years ago

janLo commented 5 years ago

Before this, if you had large datasets with a lot of objects, a huge part of the runtime went into inspect.signature() which was called for every object times every encoder.

As the signatures of the encoders does not change, we can simplify this and get the signatures only once. This reduced the runtime on a 1mb test dataset from about 15s to 2s for encoding.