▲ | opticfluorine 4 days ago | |
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#. | ||
▲ | panzi a day ago | parent | next [-] | |
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. | ||
▲ | iamflimflam1 4 days ago | parent | prev | next [-] | |
JIT compilers can outperform statically compiled code by analysing at run time exactly what branches are taken and then optimising based on that. | ||
▲ | throw-the-towel 4 days ago | parent | prev [-] | |
Could you please share some benchmark code? It would be incredibly useful as a learning aid! |