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

Performance tuning #472

Closed
wants to merge 14 commits into from
Closed

Performance tuning #472

wants to merge 14 commits into from

Conversation

maurerle
Copy link
Member

@maurerle maurerle commented Nov 6, 2024

This improves performance of all simulations by a factor of 2 up to 4, by replacing pandas actions with numpy where possible.

For this, we are using a wrapper object FastDatetimeSeries which wraps a numpy array so that we can access it using typical datetime accessors

@maurerle maurerle linked an issue Nov 6, 2024 that may be closed by this pull request
@nick-harder
Copy link
Member

@maurerle hey, looks really promising! can I contribute in any way?

@maurerle maurerle force-pushed the performance_tuning branch 2 times, most recently from 6a18a79 to 924d5cb Compare November 6, 2024 20:46
@maurerle
Copy link
Member Author

maurerle commented Nov 6, 2024

There is still a lot to do:

  • fix the tests
  • eventually rename things, if they look unintuitive or create wrappers for easier usage
  • fix all the type hints which are now outdated (should happen after renaming things of course)
  • make sure learning works as well

Some timings from me:

assume -s example_01a -db "postgresql+psycopg2://assume:assume@localhost:5432/assume"

  • main: example_01a_base 2019-01-31 00:00:00: : 2592001.0it [00:28, 92397.33it/s]
  • tuning: example_01a_base 2019-01-31 00:00:00: : 2592001.0it [00:14, 182495.12it/s]

assume -s example_01a (without writing to database at all)

  • main: example_01a_base 2019-01-31 00:00:00: : 2592001it [00:19, 132068.89it/s]
  • tuning: example_01a_base 2019-01-31 00:00:00: : 2592001it [00:04, 620880.83it/s]

python examples/world_script.py

  • main: world_script_simulation 2019-03-01 00:00:00: : 5097601.0it [00:06, 820487.43it/s]
  • tuning: world_script_simulation 2019-03-01 00:00:00: : 5097601.0it [00:03, 1671636.28it/s]

@nick-harder
Copy link
Member

@maurerle I will work on this also tomorrow in the afternoon, please fill free to write me down tasks here that I should adress tomorrow

@nick-harder
Copy link
Member

Succeeded by #483

@maurerle maurerle deleted the performance_tuning branch November 25, 2024 16:02
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.

Improve performance by switching from pandas to numpy
2 participants