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

Feature & Refactor: Add Concurrency and Filler Skips to Improve tf Effienciency. Additional CLI arguments.` #72

Merged
merged 12 commits into from
Mar 8, 2023

Conversation

spencer-tb
Copy link
Collaborator

@spencer-tb spencer-tb commented Mar 7, 2023

This PR improves our run time of tf from ~15s to ~5s.

So far I've added an additional function called parallel_fill that is equivalent to fill but with concurrency, as well as a --benchmark CLI argument that logs the run time of tf.

To test for yourself you will need to edit filler.fill() in main and switch between filler.parallel_fill(). Using tf --benchmark to log the times.

fill():
image

parallel_fill():
image

Copy link
Member

@marioevz marioevz left a comment

Choose a reason for hiding this comment

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

Looks amazing!

Only a few comments.

Thanks!

src/ethereum_test_filling_tool/main.py Outdated Show resolved Hide resolved
src/ethereum_test_filling_tool/main.py Outdated Show resolved Hide resolved
@spencer-tb spencer-tb marked this pull request as ready for review March 7, 2023 21:59
@spencer-tb spencer-tb changed the title Feature: Add Concurrency and Cache Usage to tf. Additional CLI argument --benchmark Feature & Refactor: Add Concurrency and Filler Skips to Improve tf Effienciency. Additional CLI arguments.` Mar 7, 2023
@spencer-tb
Copy link
Collaborator Author

To summarise, we now have a refactor of ethereum_test_filling_tool:

  • __init__.py
  • filler.py
  • main.py
  • modules.py

With the following features:

  • Default tf execution is concurrent/parallel. So far ~65% increase in speed. This should scale when more tests are added in the future.
  • If a filler has already been filled into a fixture (.json file), it is skipped. Unless the filler file (the entire module not the test case) has been modified or the fixture file that is generated by the module does not exist in the output path (./fixtures by default).
    • This improves speed significantly. For example, now if I have ran tf for every filler, and then modify the withdrawals module withdrawals.py, tf will only fill this module. This takes a total time of ~1.76s.
  • New CLI arguments:
    • tf --benchmark. Adds timing of filling to the output e.g: INFO:ethereum_test_filling_tool.filler:Filled test fixtures in 7.34 seconds.
    • tf --max-workers. Allows the user to set the number of workers used for concurrent tf execution. For serial execution (the previous way) use tf --max-workers 1.
    • tf --force-refill. Force tests to be filled. Works with --test-module and --test-categories.

Copy link
Member

@marioevz marioevz left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@spencer-tb spencer-tb merged commit 2dcfb50 into ethereum:main Mar 8, 2023
@spencer-tb spencer-tb deleted the tf-concurrency-cache-usage branch April 7, 2023 20:33
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.

2 participants