Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Expose PInvoke-able analyzers #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Hona
Copy link

@Hona Hona commented Apr 17, 2024

I'm not huge on rust, so feel free to be brutal in code review, or decline this PR

This is a stab at allowing the DLLs to be invoked by other languages (e.g. C#)

I have a sample repo using this change (passing tests!)

https://github.com/Hona/demostf-parser-dotnet

Integration test that invokes & asserts something about the data out :)
https://github.com/Hona/demostf-parser-dotnet/blob/master/DemosTF.Parser.NET.Tests/IntegrationTests.cs#L29-L46

@Hona
Copy link
Author

Hona commented Apr 17, 2024

Also, benchmarking programatically running the exe, versus the PInvoke, gave me a good performance improvement:

// * Summary *

BenchmarkDotNet v0.13.12, Windows 11 (10.0.22621.3447/22H2/2022Update/SunValley2)
12th Gen Intel Core i7-12800H, 1 CPU, 20 logical and 14 physical cores
.NET SDK 8.0.204
  [Host]     : .NET 8.0.4 (8.0.424.16909), X64 RyuJIT AVX2
  DefaultJob : .NET 8.0.4 (8.0.424.16909), X64 RyuJIT AVX2


| Method               | Mean     | Error    | StdDev   |
|--------------------- |---------:|---------:|---------:|
| Analyze_ProcessStart | 43.20 ms | 0.829 ms | 1.107 ms |
| Analyze_PInvoke      | 30.51 ms | 0.606 ms | 1.679 ms |

Benchmark code here: https://github.com/Hona/demostf-parser-dotnet/blob/master/DemosTf.Parser.Benchmarks/Program.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant