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

feat: memoization improvements #81

Merged
merged 28 commits into from
Apr 16, 2024
Merged

feat: memoization improvements #81

merged 28 commits into from
Apr 16, 2024

Conversation

WinPlay02
Copy link
Contributor

@WinPlay02 WinPlay02 commented Apr 8, 2024

Summary of Changes

  • shared memory
  • lazy comparisons
  • limited memory
  • value removal strategies
  • use deterministic seed for hashing

Closes #44

Depends on Safe-DS/Library#609

Copy link

github-actions bot commented Apr 8, 2024

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ PYTHON black 7 0 0 0.69s
✅ PYTHON mypy 7 0 2.57s
✅ PYTHON ruff 7 0 0 0.03s
✅ REPOSITORY git_diff yes no 0.01s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

Copy link
Contributor Author

@WinPlay02 WinPlay02 left a comment

Choose a reason for hiding this comment

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

This is still a draft, as there are some open questions

src/safeds_runner/server/_memoization_map.py Outdated Show resolved Hide resolved
src/safeds_runner/server/_memoization_map.py Outdated Show resolved Hide resolved
src/safeds_runner/server/_memoization_map.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Apr 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (6f820bf) to head (c7f8cb9).

Additional details and impacted files
@@            Coverage Diff             @@
##              main       #81    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           11        14     +3     
  Lines          530       721   +191     
==========================================
+ Hits           530       721   +191     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lars-reimann
Copy link
Member

@WinPlay02 Is this ready for review or are you still working on it?

@lars-reimann
Copy link
Member

Some quick testing shows some major performance improvements compared to main.

After clicking on "Explore Table", there's always still roughly a 3s delay between the program message and the first placeholder_type, but afterward the table view and profiling appear much faster.

That initial delay might be related to the startup delay we observed for the library, since each worker process has to load the library?

@WinPlay02
Copy link
Contributor Author

Some quick testing shows some major performance improvements compared to main.

After clicking on "Explore Table", there's always still roughly a 3s delay between the program message and the first placeholder_type, but afterward the table view and profiling appear much faster.

That initial delay might be related to the startup delay we observed for the library, since each worker process has to load the library?

Yes, that should be the Startup delay. That's now the hardest problem to solve.

@WinPlay02
Copy link
Contributor Author

@WinPlay02 Is this ready for review or are you still working on it?

It was still in draft, as the strategies now use functions instead of lambdas (passing to the pipeline process lead to a PickleError), which arguably is not as clean, but I don't know a better solution for now.

I also tried to use a process pool, as discussed on Thursday, but I didn't find a satisfying solution on how it should be handled, if the max. amount of processes has been reached. (Waiting in a queue, vs sending an Error)

Using any pool (library) doesn't map to this pipeline based usage model very well, as they are made with parallelism or concurrency in mind.

Apart from these two things, it should be reviewable

@WinPlay02 WinPlay02 marked this pull request as ready for review April 13, 2024 10:47
@WinPlay02 WinPlay02 requested a review from a team as a code owner April 13, 2024 10:47
src/safeds_runner/server/_memoization_strategies.py Outdated Show resolved Hide resolved
src/safeds_runner/server/_memoization_strategies.py Outdated Show resolved Hide resolved
src/safeds_runner/server/_memoization_utils.py Outdated Show resolved Hide resolved
Copy link
Member

@lars-reimann lars-reimann left a comment

Choose a reason for hiding this comment

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

Really nice, great work!

@lars-reimann lars-reimann merged commit 6bc2288 into main Apr 16, 2024
8 checks passed
@lars-reimann lars-reimann deleted the memoization-improvements branch April 16, 2024 19:32
lars-reimann pushed a commit that referenced this pull request Apr 17, 2024
## [0.11.0](v0.10.0...v0.11.0) (2024-04-17)

### Features

* bump `safe-ds` to `v0.21.0` ([#86](#86)) ([d780822](d780822)), closes [#85](#85)
* memoization improvements ([#81](#81)) ([6bc2288](6bc2288)), closes [#44](#44)
@lars-reimann
Copy link
Member

🎉 This PR is included in version 0.11.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lars-reimann lars-reimann added the released Included in a release label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Included in a release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improved memoization logic
3 participants