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

Canonical encoding speedup by using str.replace #410

Merged

Conversation

PradyumnaKrishna
Copy link
Contributor

Fixes: #372

Description of the changes being introduced by the pull request:

The _canonical_string_encoder() uses regex for string substitution in encoding the string to canonical form. The regex code is replaced by str.replace method which is faster in comparison of regex substitution. Few more test conditions are added.

Please verify and check that the pull request fulfils the following requirements:

  • The code follows the Code Style Guidelines
  • Tests have been added for the bug fix or new feature
  • Docs have been added for the bug fix or new feature

replace regex substitute with string replace method to encode 'string'
to canonical string format.
add test case to verify the method
Copy link
Member

@lukpueh lukpueh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, @PradyumnaKrishna! Judging from the Python docs, these two should always have the same result.

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.

potential speed up in json encoding
2 participants