You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regressions in System.Numerics.Tests.Perf_BigInteger #60293
Correct, the regression caused by PR. Situation was previously highlighted/predicted during the discussion with reviewers. Probably, the root cause is a ArrayPool<T>.Rent behavior which is slower than array allocation using new operator.
We might end up deciding that this is an acceptable trade-off from the changes made, as several other scenarios were improved in exchange. We'll leave the issue open for the time-being though and if time-permits, we'll consider an investigation into the ArrayPool<T>.Rent cost incurred.
@jeffhandley , regression is expected for all operands which are greater than 512 bits (64 bytes) in size. The current stackalloc threshold is 64 bytes. Large operands require memory pooling using ArrayPool<byte>.Shared. Note that any changes in TlsOverPerCoreLockedStacksArrayPool class have impact on BigInteger performance. Currently, TlsOverPerCoreLockedStacksArrayPool.Rent + Span<byte>.Clear are slower than new byte[size].
As for me, this is acceptable. However, we can consider NativeMemory.Alloc method (which is equivalent to malloc in C) as alternative. Anyway, we have strong control over buffer lifetime inside of BigInteger methods. But this suggestion requires confirmation and discussion.
Activity
[-][Perf] Changes at 10/11/2021 9:01:10 AM[/-][+]Regressions in System.Numerics.Tests.Perf_BigInteger[/+]EgorBo commentedon Oct 12, 2021
Likely regressed by #35565 (cc @sakno)
sakno commentedon Oct 12, 2021
Correct, the regression caused by PR. Situation was previously highlighted/predicted during the discussion with reviewers. Probably, the root cause is a
ArrayPool<T>.Rentbehavior which is slower than array allocation using new operator./cc @GrabYourPitchforks
jeffhandley commentedon Oct 12, 2021
We might end up deciding that this is an acceptable trade-off from the changes made, as several other scenarios were improved in exchange. We'll leave the issue open for the time-being though and if time-permits, we'll consider an investigation into the
ArrayPool<T>.Rentcost incurred.kunalspathak commentedon Oct 14, 2021
arm64 regression: dotnet/perf-autofiling-issues#1816
adamsitnik commentedon Mar 18, 2022
The benchmark has regressed also for other arguments:
jeffhandley commentedon Mar 30, 2022
@sakno and @kunalspathak -- do we need to investigate this any further, or are we OK closing this as expected?
sakno commentedon Mar 30, 2022
@jeffhandley , regression is expected for all operands which are greater than 512 bits (64 bytes) in size. The current stackalloc threshold is 64 bytes. Large operands require memory pooling using
ArrayPool<byte>.Shared. Note that any changes inTlsOverPerCoreLockedStacksArrayPoolclass have impact onBigIntegerperformance. Currently,TlsOverPerCoreLockedStacksArrayPool.Rent+Span<byte>.Clearare slower thannew byte[size].As for me, this is acceptable. However, we can consider
NativeMemory.Allocmethod (which is equivalent tomallocin C) as alternative. Anyway, we have strong control over buffer lifetime inside of BigInteger methods. But this suggestion requires confirmation and discussion.jeffhandley commentedon Apr 6, 2022
Thanks, @sakno. Closing as expected/accepted.