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

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

CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  1. 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

  2. CodeRabbit

    CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.

    CodeRabbit logo
  3. 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....

  4. 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)

  5. .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)

  6. preprocessor

    Boost.org preprocessor module

  7. PSRayTracing

    (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
  • An Attempt to Catch Up with JIT Compilers

    1 project | news.ycombinator.com | 3 Mar 2025
  • # Bugs and suspicious places in \.NET 9 source code

    1 project | dev.to | 7 Feb 2025
  • Inheritance and Subtyping

    1 project | news.ycombinator.com | 2 Feb 2025