Closed in0finite closed 11 months ago
This is fixed in v0.5.1, thanks for reporting
nice job 👍
It's worth noting, from my benchmarks on an M1 MacBook Pro/.NET 8, Native AOT is slower than JIT when parsing a whole demo. I'd be interested to know if you see differently.
I did some measurements. For each runtime, I made a separate publish, then ran it from command line a couple of times (I didn't use BenchmarkDotNet).
I'm using win11 x64. All runs use navi-javelins-vs-9-pandas-fearless-m1-mirage.dem
.
Runtime | Average |
---|---|
.NET 7 | 3.8 s |
.NET 8 | 4.1 s |
.NET 7 AOT | 2.2 s |
.NET 8 AOT | 1.95 s |
.NET 8 AOT with \ |
1.9s |
It seems as AOT is twice as fast ? Am i missing something ? Also, you mentioned in Readme that you can parse 1 hour of gameplay in 1.5 sec, which doesn't seem possible for me.
You'll be measuring app startup time there too, which Benchmark.Net specifically excludes. Also process startup time on Windows is very slow compared to Unix-based OSes.
Suggest using Benchmark.Net (with the DemoFile.Benchmark project) to benchmark. Otherwise you're also testing your OS, antivirus and disk read speeds.
Sorry, I forgot to mention how I measure time. This is the running process:
public static async Task Main(string[] args)
{
var path = args.SingleOrDefault() ?? throw new Exception("Expected a single argument: <path to .dem>");
var stream = File.OpenRead(path);
var sw = Stopwatch.StartNew();
var demo = new DemoParser();
await demo.Start(stream);
var elapsedMs = sw.ElapsedMilliseconds;
Console.WriteLine($"\nFinished!, elapsed {elapsedMs} ms, tick {demo.CurrentDemoTick.Value}");
}
As you can see, I measure only the processing time, no events, no file stream opening, etc.
Ok, it turns out I was measuring only the 1st run :D
So probably .NET runtime needs to warmup. After warmup, they run for ~1.6s. As for AOT, it runs for ~1.7s, so yeah it's slightly slower.
It would be great if NativeAOT compilation would be supported by the library.
This would give the benefits of faster execution, and possibility to build native library (DLL) which can then be linked by any other program (regardless of programming language).
Right now, I get this error for most of demos:
It could be a bug in
Google.Protobuf
library, but I did not investigate further, for now.