eduherminio / AoCHelper

Helper .NET library for solving Advent of Code puzzles

Home Page:https://adventofcode.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to make this aot-friendly?

mattiasnordqvist opened this issue · comments

It would be nice to get better performance!

Hi @mattiasnordqvist,

First of all, thanks for using AoCHelper and for raising this issue.

I'm happy to evaluate your feature request to make the library AOT friendly.

However, I'm surprised regarding the reason behind it, since in my experience, .NET Native AOT compiled code is generally slower than its equivalent JIT version (as of today). Less memory allocating, faster to start, smaller sized; but slower in its execution.

Hi!

Thats interesting. I don't have much experience with AOT and I don't know really what I'm missing without JIT. Yesterday was the very first time I tried AOT actually. I compiled my solution for star 5 part 2 this year with AOT, and time taken executing the code dropped from above 6ms to just under 2ms. :) One of my collegues is solving in rust, and I thought aot could help me beat him. :P

What I would recommend you is to use BenchmarkDotNet to properly measure the performance of the code, AoCHelper results are just an approximation and you shouldn't rely on them for anything super serious, such as comparing your results with your colleagues 😜

Going back to the JIT/AOT topic, your mileage might vary of course, but some JIT optimizations take place when you run your code multiple times, one of the reasons why proper benchmarking methods such as BDN 'warm up' the code before executing it, even if they execute it multiple times.
But if you rather care about first time executions and don't wanna bother using BDN, chances are you can benefit from Native AOT in some cases 🙂