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 create org/python/types/Functions until needed #902

Merged
merged 19 commits into from Aug 31, 2018

Conversation

Projects
None yet
2 participants
@patiences
Contributor

patiences commented Aug 9, 2018

Each org/python/types object does a certain amount of initialisation work which currently includes loading (creating) all the functions that are defined on python objects (+, ==, etc). This PR proposes to not create those functions until they are specifically asked for. The resulting performance gain is a modest boost for start-up time and is linear in the number of classes that are referenced/created.

Results on benchmarking test:

Without optimization

Running test_init
  Elapsed time:  0.5658640359979472  sec
  CPU process time:  0.00010599999999993948  sec
Running test_init
  Elapsed time:  0.6104675190035778  sec
  CPU process time:  9.599999999998499e-05  sec
Running test_class_init
  Elapsed time:  0.5521897639991948  sec
  CPU process time:  0.00011099999999997223  sec

With optimization

Running test_class_init
  Elapsed time:  0.32723955099936575  sec
  CPU process time:  7.900000000005125e-05  sec
Running test_class_init
  Elapsed time:  0.38820800599933136  sec
  CPU process time:  0.00010399999999999299  sec
Running test_class_init
  Elapsed time:  0.3487427390027733  sec
  CPU process time:  0.00010099999999990672  sec

About a 30% improvement, but again, this is a one-time benefit.

@patiences patiences changed the title from [WIP] Do not create org/python/types/Functions until needed to Do not create org/python/types/Functions until needed Aug 13, 2018

patiences added some commits Aug 14, 2018

@freakboy3742

👍

@freakboy3742 freakboy3742 merged commit 05a57e7 into pybee:master Aug 31, 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