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

Do not unnecessarily create strings #893

Merged
merged 1 commit into from Aug 7, 2018

Conversation

Projects
None yet
2 participants
@patiences
Copy link
Contributor

commented Aug 6, 2018

Some cleanup around org/python/types/Str creation.

@patiences

This comment has been minimized.

Copy link
Contributor Author

commented Aug 6, 2018

Interestingly enough, this cleanup results in some pretty good performance improvements especially when print is called many times:

On an existing benchmark:

Without changes

Running test_global_var_load
  Elapsed time:  33.98250968917273  sec
  CPU process time:  8.696148  sec
Running test_global_var_load
  Elapsed time:  34.428034025011584  sec
  CPU process time:  8.475584  sec
Running test_global_var_load
  Elapsed time:  33.81471260194667  sec
  CPU process time:  8.33324  sec

With changes

Running test_global_var_load
  Elapsed time:  25.94953811285086  sec
  CPU process time:  7.818179000000001  sec
Running test_global_var_load
  Elapsed time:  25.098423819988966  sec
  CPU process time:  7.770728  sec
Running test_global_var_load
  Elapsed time:  25.900512665044516  sec
  CPU process time:  7.598573  sec
@@ -24,7 +24,6 @@
org.python.types.Closure closure;

private void populateAttrs() {
org.python.types.Str name = new org.python.types.Str(method.getName());

This comment has been minimized.

Copy link
@patiences

patiences Aug 7, 2018

Author Contributor

This org/python/types/Str is never used.

@freakboy3742
Copy link
Member

left a comment

:thumb: Nice catch!

@freakboy3742 freakboy3742 merged commit fed70c1 into beeware:master Aug 7, 2018

5 checks passed

beekeeper:0/beefore:javacheckstyle Java lint checks passed.
Details
beekeeper:0/beefore:pycodestyle Python lint checks passed.
Details
beekeeper:1/smoke-test Smoke build (Python 3.4) passed.
Details
beekeeper:2/full-test:py3.5 Python 3.5 tests passed.
Details
beekeeper:2/full-test:py3.6 Python 3.6 tests passed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.