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
[SR-10604] dictionary modify accessor allocates every single time #53004
Comments
cc @rjmccall, @eeckstein |
(same for Swift 5.0.1) ran
|
better stack for the allocation:
the assembly confirms that it's allocating unconditionally pretty much before doing anything else
The first BB in the SIL looks like this
|
We know there's work to do to make the coroutine lowering passes more aggressive about not heap-allocating the stack frame if e.g. there are multiple resume points. This SR will serve as a fine anchor for tracking that work. |
@swift-ci create |
I submitted a stdlib-side workaround: This can be reverted when the underlying optimization issue is resolved. |
Recent testing with Swift 5.3 seems to show allocations back in the dictionary modify accessor, in the exact same place. @lorentey did we regress this in any way? |
Additional Detail from JIRA
md5: 4ba5c6b107c61899a4524c1db392517b
relates to:
Issue Description:
@Lukasa just showed me some of his HTTP/2 code that allocates a lot. He saw it allocating in presumably here:
swift/stdlib/public/core/DictionaryVariant.swift
Line 97 in 577e04d
But the whole complexity of the http/2 code isn't actually necessary, even the most simple use of the modify accessor triggers the allocations:
ran, produces under dtrace that traces every
malloc
:That means for 10,000 calls to the modify accessor, we allocated 10,000 times :'(.
We can reduce the code further to
The text was updated successfully, but these errors were encountered: