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

Small speedups for _flatten_impl and others #345

Merged
merged 2 commits into from Jan 31, 2021
Merged

Small speedups for _flatten_impl and others #345

merged 2 commits into from Jan 31, 2021

Conversation

Theelx
Copy link
Contributor

@Theelx Theelx commented Jan 18, 2021

Speeds up Pickler._flatten_impl, Pickler._get_flattener, and util._is_function.

_flatten_impl:

  • Condense type checks
  • Remove function call

_get_flattener:

  • Removed slow function alias
  • Rearranged checks to check more common cases first

is_function:

  • Avoided construction of a new set every call

@Theelx
Copy link
Contributor Author

Theelx commented Jan 19, 2021

Hmm, it looks like this breaks 2.7 so it'd be better for v2.0

@Theelx
Copy link
Contributor Author

Theelx commented Jan 30, 2021

@davvid Thoughts? I fixed it for 2.7

@davvid davvid merged commit c04afce into jsonpickle:master Jan 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants