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

PR: Make validation of blocks with Outline explorer data faster #18310

Merged
merged 1 commit into from
Jun 19, 2022

Conversation

impact27
Copy link
Contributor

Description of Changes

  • Wrote at least one-line docstrings (for any new functions)
  • Added unit test(s) covering the changes (if testable)
  • Included a screenshot or animation (if affecting the UI, see Licecap)

Refactor is_valid for performance

5.x:

>>> spy.window.editor.new()
>>> spy.window.editor.get_current_editor().set_text("#%%\nprint(0)\n"*1000)
>>> import timeit
>>> timeit.timeit("spy.window.editor.run_cell_and_advance()", number=1000, globals={"spy":spy})
7.448802667999999

this PR:

>>> spy.window.editor.new()
>>> spy.window.editor.get_current_editor().set_text("#%%\nprint(0)\n"*1000)
>>> timeit.timeit("spy.window.editor.run_cell_and_advance()", number=1000, globals={"spy":spy})
4.625459233000015

60% faster to run cell and advance

Issue(s) Resolved

Fixes #

Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

I certify the above statement is true and correct:

@@ -2270,7 +2270,7 @@ def good(oedata):
oedata for oedata in self.highlighter._cell_list if good(oedata)]

return sorted(
{oedata.get_block_number(): oedata
{oedata.block.blockNumber(): oedata
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The cells were just tested for validity, no need to do it twice

@ccordoba12 ccordoba12 changed the title PR: Faster is_valid PR: Make validation of Outline explorer data faster Jun 19, 2022
@ccordoba12 ccordoba12 changed the title PR: Make validation of Outline explorer data faster PR: Make validation of blocks with Outline explorer data faster Jun 19, 2022
@ccordoba12 ccordoba12 added this to the v5.3.2 milestone Jun 19, 2022
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks @impact27!

@ccordoba12 ccordoba12 merged commit 9f3cf8c into spyder-ide:5.x Jun 19, 2022
ccordoba12 added a commit that referenced this pull request Jun 19, 2022
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