Giter Site home page Giter Site logo

dotnet-burst-comparison's Issues

.NET 8 Benchmarks are likely testing "cold"

The readme notes:

Each benchmark is run twice to let each runtime warm up. These results are from the second run. Smaller values are better.

However, modern .NET (.NET Core 2.1+) uses "Tiered Compilation" and that defaults to needing approx. 30 invocations and a delay of 1ms where no other Tier-0 code is jitted before methods can start being promoted to Tier-1

The very latest versions (.NET 7+) do have some support for OSR (On Stack Replacement) in which a hot loop may be replaced even when the rest of the method body hasn't been optimized and I expect that's what's happening for these benchmarks (as many do have loops that execute far more than 30 invocations). However, that is still going to miss some opts and pessimize the overall codegen.

In general, I'd recommend either:

  • disabling TieredCompilation (https://learn.microsoft.com/en-us/dotnet/core/runtime-config/compilation)
  • ensuring that a minimum of 30-50 invocations occur and a sufficient pause time (1-5ms) exists before measuring to allow rejit to kick in
  • just use Benchmark.NET which will handle all of this for you, ensuring enough invocations occur and the relevant statistical analysis is done to find and account for noise, outlier results, etc.

If you go with the first approach (disabling TC), it's worth noting that this also opts you out of things like DynamicPGO and optimizations that can only occur via a TieredJIT where you know some code has executed at least once.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.