GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-108303: Move `Lib/test/sortperf.py` to `Tools/scripts` by sobolevn · Pull Request #114687 · python/cpython

Conversation

@sobolevn

@sobolevn sobolevn commented Jan 28, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

@corona10 what do you think about moving these case to pyperformance? Would it be benefitial?

  • Issue: Move test files into test subdirectories #108303

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sobolevn
pythongh-108303: Remove Lib/test/sortperf.py
6903baa
@sobolevn
sobolevn requested a review from vstinner January 28, 2024 20:18
@bedevere-app bedevere-app Bot added the awaiting review label Jan 28, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Jan 28, 2024
Move test files into test subdirectories #108303
Closed
@sobolevn sobolevn added the skip news label Jan 28, 2024
@vstinner

vstinner commented Jan 29, 2024

Copy link
Copy Markdown
Member

Which change (who) created this script? Is it @corona10?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn

sobolevn commented Jan 29, 2024

Copy link
Copy Markdown
Member Author

It was Guido 27 years ago: https://github.com/python/cpython/commits/main/Lib/test/sortperf.py

I think he agreed on moving it away in Discord's #python-dev channel.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

corona10
corona10 requested changes Jan 29, 2024
View reviewed changes

@corona10 corona10 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

IMO, the First thing we have to do is add the benchmark script, not remove the file.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting changes and removed awaiting review labels Jan 29, 2024
@bedevere-app

bedevere-app Bot commented Jan 29, 2024

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn

sobolevn commented Jan 29, 2024

Copy link
Copy Markdown
Member Author

@corona10 ok, I will send a PR to pyperformance soon! 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn sobolevn mentioned this pull request Feb 7, 2024
Add list.sort benchmarks python/pyperformance#328
Closed
sobolevn added 2 commits February 9, 2024 14:56
@sobolevn
Revert "pythongh-108303: Remove Lib/test/sortperf.py"
145f089
This reverts commit 6903baa.
@sobolevn
Move Lib/test/sortperf.py to Tools/scripts
3b38525
@sobolevn sobolevn changed the title gh-108303: Remove Lib/test/sortperf.py gh-108303: Move Lib/test/sortperf.py to Tools/scripts Feb 9, 2024
@sobolevn
sobolevn requested a review from corona10 February 9, 2024 11:57
corona10
corona10 reviewed Feb 9, 2024
View reviewed changes

@corona10 corona10 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Even if we just move the script into Tools/script
IMO pyperf based script is more modernized way and easy to compare with improvement patch. WDYT?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sobolevn

sobolevn commented Feb 9, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

I agree with Guido: it is not really that useful as a benchmark (since it is a micro-benchmark). It is only interesting when working on list.sort directly. And I don't think that this is going to happen anytime soon, since the sorting algorithm is quite old, fast, and stable.

So, I think that we can move this file for now. If someone has a real use-case for list.sort benchmark in pyperf, they can recreate my existing closed PR.

And for now this file would serve more like a history reference.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@corona10

corona10 commented Feb 10, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

So, I think that we can move this file for now. If someone has a real use-case for list.sort benchmark in pyperf, they can recreate my existing closed PR.

Ah, I meant rewriting the benchmark script based on pyperf(you already did) and storing it Tools/script/, I did not mean to move new script to pyperformance, I also agree with Guido, it will not be a proper place.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn

sobolevn commented Feb 10, 2024

Copy link
Copy Markdown
Member Author

@corona10 sure!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sobolevn added 3 commits February 10, 2024 15:17
@sobolevn
Use pyperf script
979bca0
@sobolevn
Fix CI
052ec30
@sobolevn
Merge branch 'main' into issue-108303-sortperf
273eed8
@corona10

corona10 commented Feb 11, 2024

Copy link
Copy Markdown
Member

I will take a look at the PR by tomorrow :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

corona10
corona10 requested changes Feb 12, 2024
View reviewed changes

@corona10 corona10 left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

  1. By default, all benchmark should be executed.
  2. Benchmarks needs some tune up
.....................
list_sort: Mean +- std dev: 30.8 ms +- 0.4 ms
.....................
list_sort_ascending: Mean +- std dev: 1.76 ms +- 0.10 ms

Execution time is too long :(
(Maybe we need to control inner_loops value)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Tools/scripts/sortperf.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Tools/scripts/sortperf.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Tools/scripts/sortperf.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn
Merge branch 'main' into issue-108303-sortperf
6c549d6
@sobolevn

sobolevn commented Feb 15, 2024

Copy link
Copy Markdown
Member Author

@corona10 I've merged your suggestions. Thank you!

I've also optimized the benchmark:

» time python Tools/scripts/sortperf.py  
.....................
list_sort: Mean +- std dev: 29.0 us +- 0.2 us
.....................
list_sort_ascending: Mean +- std dev: 28.9 us +- 0.4 us
.....................
list_sort_ascending_exchanged: Mean +- std dev: 29.2 us +- 0.4 us
.....................
list_sort_ascending_one_percent: Mean +- std dev: 29.5 us +- 0.2 us
.....................
list_sort_ascending_random: Mean +- std dev: 29.6 us +- 0.3 us
.....................
list_sort_descending: Mean +- std dev: 29.5 us +- 0.2 us
.....................
list_sort_duplicates: Mean +- std dev: 30.4 us +- 1.1 us
.....................
list_sort_equal: Mean +- std dev: 29.2 us +- 0.2 us
.....................
list_sort_worst_case: Mean +- std dev: 29.2 us +- 0.2 us
python Tools/scripts/sortperf.py  98.38s user 3.21s system 99% cpu 1:41.75 total

Is it good enough?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn
Address review
7c2dd81
corona10
corona10 approved these changes Feb 17, 2024
View reviewed changes

@corona10 corona10 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

@sobolevn Feel free to merge the PR anytime!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting changes labels Feb 17, 2024
@sobolevn

sobolevn commented Feb 18, 2024

Copy link
Copy Markdown
Member Author

@corona10 Thank you! 🎉

I think that we also need to backport this to 3.11 and 3.12
Do you agree?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@corona10

corona10 commented Feb 18, 2024

Copy link
Copy Markdown
Member

Yeah go a head

sobolevn reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn sobolevn added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Feb 18, 2024
@sobolevn
sobolevn merged commit f9154f8 into python:main Feb 18, 2024
@bedevere-app bedevere-app Bot removed the awaiting merge label Feb 18, 2024
@miss-islington-app

miss-islington-app Bot commented Feb 18, 2024

Copy link
Copy Markdown

Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 18, 2024
@sobolevn @miss-islington
pythongh-108303: Move Lib/test/sortperf.py to Tools/scripts (pyth…
f52145e
…onGH-114687)

(cherry picked from commit f9154f8)

Co-authored-by: Nikita Sobolev <[email protected]>
@bedevere-app

bedevere-app Bot commented Feb 18, 2024

Copy link
Copy Markdown

GH-115625 is a backport of this pull request to the 3.12 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.12 only security fixes label Feb 18, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 18, 2024
@sobolevn @miss-islington
pythongh-108303: Move Lib/test/sortperf.py to Tools/scripts (pyth…
c846be2
…onGH-114687)

(cherry picked from commit f9154f8)

Co-authored-by: Nikita Sobolev <[email protected]>
@bedevere-app

bedevere-app Bot commented Feb 18, 2024

Copy link
Copy Markdown

GH-115626 is a backport of this pull request to the 3.11 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.11 only security fixes label Feb 18, 2024
sobolevn added a commit that referenced this pull request Feb 18, 2024
@miss-islington @sobolevn
[3.11] gh-108303: Move Lib/test/sortperf.py to Tools/scripts (GH-…
9126232
…114687) (#115626)

gh-108303: Move `Lib/test/sortperf.py` to `Tools/scripts` (GH-114687)
(cherry picked from commit f9154f8)

Co-authored-by: Nikita Sobolev <[email protected]>
sobolevn added a commit that referenced this pull request Feb 18, 2024
@miss-islington @sobolevn
[3.12] gh-108303: Move Lib/test/sortperf.py to Tools/scripts (GH-…
dd961d8
…114687) (#115625)

gh-108303: Move `Lib/test/sortperf.py` to `Tools/scripts` (GH-114687)
(cherry picked from commit f9154f8)

Co-authored-by: Nikita Sobolev <[email protected]>
woodruffw pushed a commit to woodruffw-forks/cpython that referenced this pull request Mar 4, 2024
@sobolevn @woodruffw
pythongh-108303: Move Lib/test/sortperf.py to Tools/scripts (pyth…
67b6939
…on#114687)
@pochmann3 pochmann3 mentioned this pull request Mar 10, 2024
sortperf.py is broken #116576
Closed
@sobolevn sobolevn mentioned this pull request Mar 10, 2024
gh-116576: Fix Tools/scripts/sortperf.py sorting the same list #116577
Merged
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
@sobolevn @diegorusso
pythongh-108303: Move Lib/test/sortperf.py to Tools/scripts (pyth…
3f47339
…on#114687)
LukasWoodtli pushed a commit to LukasWoodtli/cpython that referenced this pull request Jan 22, 2025
@sobolevn @LukasWoodtli
pythongh-108303: Move Lib/test/sortperf.py to Tools/scripts (pyth…
4fb68a3
…on#114687)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@corona10 corona10 corona10 approved these changes
@vstinner vstinner Awaiting requested review from vstinner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@sobolevn @vstinner @corona10
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.