Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GH-100425: Timing experiment: For builtin_sum, try replacing Fast2Sum with 2Sum#100860

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
rhettinger wants to merge1 commit intopython:mainfromrhettinger:sum_optimization

Conversation

@rhettinger
Copy link
Contributor

@rhettingerrhettinger commentedJan 8, 2023
edited by bedevere-bot
Loading

On the Apple M1 Max, this change makes no difference. I get 303/304 nsec per loop before and after the edit.

Would anyone care to run this on their builds and report back the results?

% ./python.exe -m timeit -r21 -s 'n=100' -s 'from random import expovariate as r' -s 'v1=[r(1000) + r(0.125) for i in range(n)]'   'sum(v1)'1000000 loops, best of 21: 304 nsec per loop

@hauntsaninja
Copy link
Contributor

I see no difference either, on Linux with an AMD Zen 2 chip

@eendebakpt
Copy link
Contributor

Both with and without optimizations I see no difference. System: Linux, gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1), Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz

@rhettinger
Copy link
ContributorAuthor

Thank you both. It would be nice to hear from a Windows person as well.

@eendebakpt
Copy link
Contributor

Thank you both. It would be nice to hear from a Windows person as well.

On Windows (default PCbuild/build.bat, no PGO) the timings vary a lot on my system (Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz, Windows 10, VS 2019). For this PR, measurements within 5 minutes:

image

I can confirm that the minimum time for the test is roughly the same for main and this PR.

@rhettinger
Copy link
ContributorAuthor

Thank you. I appreciate it.

@mdickinson Given that 2Sum and Fast2Sum have the same performance in the context ofbuiltin.sum(), do we have a non-performance reason to choose one over the other? Or should I leave thesum() code as-is?

@rhettingerrhettinger changed the titleTiming experiment: For builtin_sum, try replacing Fast2Sum with 2SumGH-100425: Timing experiment: For builtin_sum, try replacing Fast2Sum with 2SumJan 12, 2023
@mdickinson
Copy link
Member

@rhettinger Leaving as-is sounds good to me. The two should be functionally identical, so performance is just about the only thing that would justify choosing one over the other.

rhettinger reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@mdickinsonmdickinsonAwaiting requested review from mdickinson

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@rhettinger@hauntsaninja@eendebakpt@mdickinson@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp