The Performance Impact of C++'s `final` Keyword

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • Roslyn

    The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.

  • .NET is a little smarter about switch code generation these days: https://github.com/dotnet/roslyn/pull/66081

  • styx

  • > I'd love to see the codegen differences between the applications

    There are two applications, dynamic calls and dynamic casts.

    Dynamic casts to final classes dont require to check the whole inheritance chain. Recently done this in styx [0]. The gain may appear marginal, e.g 3 or 4 dereferences saved but in programs based on OOP you can easily have *Billions* of dynamic casts saved.

    [0]: https://gitlab.com/styx-lang/styx/-/commit/62c48e004d5485d4f....

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • CoreCLR

    Discontinued CoreCLR is the runtime for .NET Core. It includes the garbage collector, JIT compiler, primitive data types and low-level classes.

  • Yes, that is true. I'm not sure about JVM implementation details but the reason the comment says "virtual and interface" calls is to outline the difference. Virtual calls in .NET are sufficiently close[0] to virtual calls in C++. Interface calls, however, are coded differently[1].

    Also you are correct - virtual calls are not terribly expensive, but they encroach on ever limited* CPU resources like indirect jump and load predictors and, as noted in parent comments, block inlining, which is highly undesirable for small and frequently called methods, particularly when they are in a loop.

    * through great effort of our industry to take back whatever performance wins each generation brings with even more abstractions that fail to improve our productivity

    [0] https://github.com/dotnet/coreclr/blob/4895a06c/src/vm/amd64...

    [1] https://github.com/dotnet/runtime/blob/main/docs/design/core... (mind you, the text was initially written 18 ago, wow)

  • .NET Runtime

    .NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.

  • Yes, that is true. I'm not sure about JVM implementation details but the reason the comment says "virtual and interface" calls is to outline the difference. Virtual calls in .NET are sufficiently close[0] to virtual calls in C++. Interface calls, however, are coded differently[1].

    Also you are correct - virtual calls are not terribly expensive, but they encroach on ever limited* CPU resources like indirect jump and load predictors and, as noted in parent comments, block inlining, which is highly undesirable for small and frequently called methods, particularly when they are in a loop.

    * through great effort of our industry to take back whatever performance wins each generation brings with even more abstractions that fail to improve our productivity

    [0] https://github.com/dotnet/coreclr/blob/4895a06c/src/vm/amd64...

    [1] https://github.com/dotnet/runtime/blob/main/docs/design/core... (mind you, the text was initially written 18 ago, wow)

  • preprocessor

    Boost.org preprocessor module

  • (I am the author of the issue)

    [1] https://gitlab.com/define-private-public/PSRayTracing/-/issu...

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Why is Python so popular?

    3 projects | /r/Python | 27 Mar 2022
  • .NET 6 Preview 1 Released

    6 projects | /r/programming | 17 Feb 2021
  • Asynchronous Programming in C#

    9 projects | news.ycombinator.com | 30 Apr 2024
  • Airline keeps mistaking 101-year-old woman for baby

    1 project | news.ycombinator.com | 28 Apr 2024
  • The software industry rapidly convergng on 3 languages: Go, Rust, and JavaScript

    1 project | news.ycombinator.com | 24 Apr 2024