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-121263: Macro-ify most stackref functions for MSVC by Fidget-Spinner · Pull Request #121270 · python/cpython

Conversation

@Fidget-Spinner

@Fidget-Spinner Fidget-Spinner commented Jul 2, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member
  • Issue: Stackrefs (#118450) introduced a large performance regression on Windows  #121263

Sorry, something went wrong.

Uh oh!

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

All reactions
@Fidget-Spinner
Macro-ify most stackref functions for MSVC
2302696
@bedevere-app bedevere-app Bot mentioned this pull request Jul 2, 2024
Stackrefs (#118450) introduced a large performance regression on Windows #121263
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label Jul 2, 2024
@Fidget-Spinner Fidget-Spinner added the skip news label Jul 2, 2024
@Fidget-Spinner

Fidget-Spinner commented Jul 2, 2024

Copy link
Copy Markdown
Member Author

cc @mdboom

All reactions

Sorry, something went wrong.

Uh oh!

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

@mdboom

mdboom commented Jul 2, 2024

Copy link
Copy Markdown
Contributor

Kicking off a benchmarking run now...

All reactions

Sorry, something went wrong.

Uh oh!

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

@mdboom

mdboom commented Jul 2, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

The raw benchmaring results are here.

This PR makes things 5% faster on 64-bit Windows, 7% faster on 32-bit Windows, and no measurable change on x86_64 Linux.

The important comparison, however, is whether this change counteracts all of the negative effects of #118450. Comparing directly to commit d611c4c (the commit immediately before #118450 landed), shows the same amount of speedup 5% faster on 64-bit Windows, 7% faster on 32-bit Windows, and no measurable change on x86_64 Linux.

So this PR is effective and seems to make up for the regression.

However... if we could hold off on merging it until we confirm one other thing. @zooba reminded me that we still have a pragma "hack" to disable optimization on MSVC for the main eval loop. This was introduced to work around a compiler crash when the main eval loop function got extremely large (when the Tier 2 and Tier 2 interpreters were merged together). Of course, this hack is no longer needed for non-JIT builds, since they no longer include the Tier 2 interpreter. I am doing another benchmarking run just removing the hack to see if it also fixes the performance issue -- if we can do that and use inline functions rather than macros, that seems preferable.

EDIT: Added link to change that removed Tier 2 interpreter from default builds.

All reactions

Sorry, something went wrong.

Uh oh!

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

@Fidget-Spinner

Fidget-Spinner commented Jul 3, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

Thanks Mike for the attempt! Sadly, removing the pragma doesn't seem to speed up anything:
https://github.com/faster-cpython/benchmarking-public/tree/main/results/bm-20240702-3.14.0a0-a03affd

As the reported benchmark results are good, and this PR seems to make up for all the perf loss, I will merge this PR, to restore performance of Windows builds.

All reactions

Sorry, something went wrong.

Uh oh!

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

@Fidget-Spinner
Fidget-Spinner merged commit 722229e into python:main Jul 3, 2024
@bedevere-app bedevere-app Bot removed the awaiting core review label Jul 3, 2024
@Fidget-Spinner
Fidget-Spinner deleted the macro-ify branch July 3, 2024 09:49
@Fidget-Spinner Fidget-Spinner added the topic-free-threading label Jul 3, 2024
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
@Fidget-Spinner @estyxx
pythongh-121263: Macro-ify most stackref functions for MSVC (pythonGH…
d2927af
…-121270)

Macro-ify most stackref functions for MSVC
mdboom added a commit to mdboom/cpython that referenced this pull request Jul 19, 2024
@mdboom
Revert "pythongh-121263: Macro-ify most stackref functions for MSVC (p…
0853d0e
…ythonGH-121270)"

This reverts commit 722229e.
@mdboom mdboom mentioned this pull request Jul 19, 2024
Change MSBuild to use the Clang backend faster-cpython/ideas#690
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

skip news topic-free-threading

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.

2 participants

@Fidget-Spinner @mdboom
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.