Skip to content
This repository has been archived by the owner. It is now read-only.

Do not unnecessarily create strings #893

Merged
merged 1 commit into from Aug 7, 2018
Merged

Conversation

@patiences
Copy link
Contributor

@patiences patiences commented Aug 6, 2018

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

@patiences
Copy link
Contributor Author

@patiences patiences 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());
Copy link
Contributor Author

@patiences patiences Aug 7, 2018

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

Copy link
Member

@freakboy3742 freakboy3742 left a comment

:thumb: Nice catch!

@freakboy3742 freakboy3742 merged commit fed70c1 into beeware:master Aug 7, 2018
5 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants