Skip to content

fix: O(n³) runtime fix#185

Open
Masara wants to merge 32 commits intomainfrom
fix-docstring-runtime
Open

fix: O(n³) runtime fix#185
Masara wants to merge 32 commits intomainfrom
fix-docstring-runtime

Conversation

@Masara
Copy link
Contributor

@Masara Masara commented Nov 10, 2024

Big libraries like PyTorch had a runtime of about 20-30 Minutes, which was because of unoptimized code in the _check_publicity_in_reexports() function. Now the runtime takes about ~2 minutes for PyTorch.

Either merge this branch into the various_fixes branch or merge various_fixes into main first, followed by this branch.

Summary of Changes

  • Optimized the _check_publicity_in_reexports() code, which has a runtime of O(n³)
  • Optimized stub string generator code
  • Optimized griffe docstring parser code by adding an indexer

Masara added 22 commits August 18, 2024 16:53
…ready in there would be appended to the file once more
…ugh having a "return" without any type; fixed a bug where attributes would not have a type even though a type is defined the docstrings
…or the loaded griffe data instead of parsing through it every time we search for a specific docstring
…e stub generator, which probably takes about O(n^3) right now.
Base automatically changed from various_fixes to main March 7, 2025 16:20
# Conflicts:
#	src/safeds_stubgen/api_analyzer/_ast_visitor.py
#	src/safeds_stubgen/docstring_parsing/_docstring_parser.py
#	src/safeds_stubgen/stubs_generator/_stub_string_generator.py
@github-actions
Copy link

github-actions bot commented Mar 7, 2025

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ PYTHON mypy 3 0 0 6.71s
✅ PYTHON ruff 3 0 0 0 0.03s
✅ REPOSITORY git_diff yes no no 0.02s

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

@codecov
Copy link

codecov bot commented Mar 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.84%. Comparing base (70cb952) to head (3e5962f).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #185   +/-   ##
=======================================
  Coverage   99.84%   99.84%           
=======================================
  Files          26       26           
  Lines        2616     2618    +2     
=======================================
+ Hits         2612     2614    +2     
  Misses          4        4           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Unfortunately, this breaks the generation of imports.

Previously, the following import was created:

from safeds.ml.classical.classification import Classifier

Now it is this:

from classifier import Classifier

@Masara Masara force-pushed the fix-docstring-runtime branch from 9c8de70 to 2a3cb09 Compare April 3, 2025 22:51
@Masara
Copy link
Contributor Author

Masara commented Apr 3, 2025

@lars-reimann, should be fixed now. Please have a look and tell me if there's still something wrong.

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