Skip to content

Regressions in System.Numerics.Tests.Perf_BigInteger #60293

Closed

Description

@performanceautofiler

Run Information

Architecture x64
OS Windows 10.0.19042
Baseline 6c09f34947026ed988fd3013fdaa624a5fab0f26
Compare 9dcde5f8a182a9202a50afa92fec463f6654ecd9
Diff Diff

Regressions in System.Numerics.Tests.Perf_BigInteger

Benchmark Baseline Test Test/Base Test Quality Edge Detector Baseline IR Compare IR IR Ratio Baseline ETL Compare ETL
Subtract - Duration of single invocation 49.13 ns 72.31 ns 1.47 0.07 True

graph
Test Report

Repro

git clone https://github.com/dotnet/performance.git
py .\performance\scripts\benchmarks_ci.py -f net6.0 --filter 'System.Numerics.Tests.Perf_BigInteger*'
Details

Payloads

Baseline
Compare

Histogram

System.Numerics.Tests.Perf_BigInteger.Subtract(arguments: 1024,1024 bits)


Docs

Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository

Activity

  1. changed the title [-][Perf] Changes at 10/11/2021 9:01:10 AM[/-] [+]Regressions in System.Numerics.Tests.Perf_BigInteger[/+] on Oct 12, 2021
  2. ghost added
    untriaged
    on Oct 12, 2021
  3. EgorBo commented on Oct 12, 2021

    @EgorBo
    Member

    Likely regressed by #35565 (cc @sakno)

  4. sakno commented on Oct 12, 2021

    @sakno
    Contributor

    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.

    /cc @GrabYourPitchforks

  5. added this to the 7.0.0 milestone on Oct 12, 2021
  6. removed
    untriaged
    on Oct 12, 2021
  7. jeffhandley commented on Oct 12, 2021

    @jeffhandley
    Member

    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.

  8. kunalspathak commented on Oct 14, 2021

    @kunalspathak
    Contributor
  9. adamsitnik commented on Mar 18, 2022

    @adamsitnik
    Member

    The benchmark has regressed also for other arguments:

    image

  10. jeffhandley commented on Mar 30, 2022

    @jeffhandley
    Member

    @sakno and @kunalspathak -- do we need to investigate this any further, or are we OK closing this as expected?

  11. sakno commented on Mar 30, 2022

    @sakno
    Contributor

    @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.

  12. jeffhandley commented on Apr 6, 2022

    @jeffhandley
    Member

    Thanks, @sakno. Closing as expected/accepted.

  13. ghost locked as resolved and limited conversation to collaborators on May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions