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

cmd/compile: 1.15 heap allocations regression when calling Write on os.Stdout [1.15 backport] #41543

Closed
gopherbot opened this issue Sep 21, 2020 · 3 comments

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Sep 21, 2020

@ianlancetaylor requested issue #41474 to be considered for backport to the next 1.15 minor release.

@gopherbot Please open a backport issue for 1.15.

This is an unexpected and unavoidable performance regression in 1.15: using Write to write a []byte forces the []byte to escape into the heap. That did not happen in 1.14.

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Sep 22, 2020

Change https://golang.org/cl/256418 mentions this issue: [release-branch.go1.15] internal/poll: adjust ignoringEINTR to avoid slice escape

Loading

@cagedmantis
Copy link
Contributor

@cagedmantis cagedmantis commented Sep 24, 2020

Approved because this is a serious issue without a workaround.

Loading

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Sep 24, 2020

Closed by merging fa01c8a to release-branch.go1.15.

Loading

@gopherbot gopherbot closed this Sep 24, 2020
gopherbot pushed a commit that referenced this issue Sep 24, 2020
…slice escape

The 1.15 compiler is not quite smart enough to see that the byte slice
passed to ignoringEINTR does not escape. This ripples back up to user
code which would see a byte slice passed to os.(*File).Write escape,
which did not happen in 1.14.

Rather than backport some moderately complex compiler fixes, rewrite
the code slightly so that the 1.15 compiler is able to see that the
slice does not escape.

This is not a backport from tip, where the code is already different.
The test for this will be on tip, where we will most likely change the
compiler to understand this kind of code.

Fixes #41543
For #41474

Change-Id: I6c78164229fea7794e7edba512bfd7034a0b91c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/256418
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
claucece added a commit to claucece/go that referenced this issue Oct 22, 2020
…slice escape

The 1.15 compiler is not quite smart enough to see that the byte slice
passed to ignoringEINTR does not escape. This ripples back up to user
code which would see a byte slice passed to os.(*File).Write escape,
which did not happen in 1.14.

Rather than backport some moderately complex compiler fixes, rewrite
the code slightly so that the 1.15 compiler is able to see that the
slice does not escape.

This is not a backport from tip, where the code is already different.
The test for this will be on tip, where we will most likely change the
compiler to understand this kind of code.

Fixes golang#41543
For golang#41474

Change-Id: I6c78164229fea7794e7edba512bfd7034a0b91c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/256418
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
@golang golang locked and limited conversation to collaborators Sep 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants