Re:What's New in C# 14: Null-Conditional Assignments
by opticfluorine on Thursday September 18, 2025 @08:06AM
(#45288605)
I have occasionally, just for fun, written benchmarks for some algorithm in C++ and an equivalent C# implementation, them tried to bring the managed performance in line with native using the methods you mention and others. I'm always surprised by how often I can match the performance of the unmanaged code (even when I'm trying to optimize my C++ to the limit) while still ending up with readable and maintainable C#.
[ Parent
| on HN ]
Re:What's New in C# 14: Null-Conditional Assignments
by iamflimflam1 on Thursday September 18, 2025 @04:10PM
(#45294366)
JIT compilers can outperform statically compiled code by analysing at run time exactly what branches are taken and then optimising based on that.
Re:What's New in C# 14: Null-Conditional Assignments
by throw-the-towel on Thursday September 18, 2025 @04:48PM
(#45294826)
Could you please share some benchmark code? It would be incredibly useful as a learning aid!
Re:What's New in C# 14: Null-Conditional Assignments
by panzi on Sunday September 21, 2025 @10:03AM
(#45322847)
Does this include the GC at the end of it all? Because if that happens after the end timestamp it's not an exact comparison. I read something once about speeding up a C/C++ compiler by simply turning free into a no-op. Such a compiler basically allocates more and more data and only frees it all at the end of execution, so then doing all the free calls is just wasted CPU cycles.