-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
runtime: it looks many slice operations become 20%+ slower on tip #49744
Comments
CC @randall77 |
I was curious and bisected with the given test cases. I found the following:
|
Thanks for bisecting. cc @mknyszek too, then. |
I suspect this is just the new minimum heap size (512 KiB). Microbenchmarks suffer because they have a small heap, so you GC more often to save memory. Instead of We're thinking we're going to roll back just the new minimum heap size for 1.18, and try again later. |
I can confirm that restoring |
Cool. I think this is a non-issue for this release, but it's helped find a lot of various finalizer bugs and such in our tests (and elsewhere) so I'm leaving it in for just a little longer. I'll leave this open until we roll back the heap minimum. |
Random thought: If/when PGO (profile guided optimization) lands, perhaps it could be used to determine a reasonable minimum heap? This could be useful for short-lived utilities. |
@mpx, that's an interesting idea. I think first we're going to try to see if we can just make the GC scale down better. My hypothesis is that the smaller minimum heap size is primarily a problem because of the high constant overheads of starting a GC (it used to be the "small heap amortization problem"—we didn't account properly for all sources of GC work and non-heap work could dominate for small heaps—but the new pacer fixes that). There's probably always going to be some amount of cost for things that genuinely run on very small heaps (after all, a smaller minimum heap trades CPU for RAM in that regime), but my instinct is that it shouldn't be nearly as high as what we're seeing. If we can fix it that way, it may simply obviate the issue. |
Change https://golang.org/cl/368137 mentions this issue: |
What version of Go are you using (
go version
)?What did you do?
https://play.golang.org/p/HM5X5crNSr4
What did you expect to see?
Similar performance,
What did you see instead?
Tip is much slower for both of the benchmarks.
The following is the benchstat results:
This could be also verified by run
go test -bench=. -benchmem slice_test.go
in thesrc/runtime
dir.Most benchmarks spend more time than v1.17.3, except several ones like BenchmarkAppend*/*.
The text was updated successfully, but these errors were encountered: