Using BenchmarkDotNet with RhinoCommon

I’ve been trying to create some simple Benchmarking tests for some methods in a library for our RhinoPlugin. The methods use Rhino Geometry and so need to reference the RhinoCommon.dll correctly to resolve.

This however doesn’t work, it fails to find the RhinoCommon Assembly. I’ve even tried adding in an AssemblyResolver but this hasn’t fixed the issue.

Has anyone successfully Created a BenchmarkDotNet test with RhinoCommon Geometry?

– cs

I managed to get it to run by copying the RhinoCommon.dll into the Release directory. Although I don’t like this solution so I’m going to leave this issue open for better suggestions.

First time I hear of BenchmarkDotNet, which I suppose is GitHub - dotnet/BenchmarkDotNet: Powerful .NET library for benchmarking.

You’ll have te ensure you run the benchmarks inside Rhino to properly test, since RhinoCommon.dll won’t work outside of it.

But I’ve managed to run Unit Tests outside of Rhino before using this project;

Is there not possibly a way to do something similar to this?

Any functionality that requires a Rhino license will not run outside Rhino. My experience is that yes, you can put RhinoCommon.dll in the same directory, and some tests may run that don’t do anything fancy, like curve intersections, surface intersections or Boolean operations.

You probably also need all the dependencies of RhinoCommon.dll from the installation directory.

If you want to be on the safe side you really should run benchmark tests from within Rhino.

You probably could do some Rhino Inside approach, but it still means essentially running inside Rhino…

Could you please shed some more light on this topic @nathanletwory?
My layman’s approach to benchmarking so far was setting a System.Diagnostics.Stopwatch in VS and logging its output while running my logic. What would be a more structured approach to benchmarking from within Rhino?

Didnt have time to look at it yet, but my colleague recommended looking into slimtune as it can attach to already running tasks. His friend uses it for games.

https://code.google.com/archive/p/slimtune/

You can run BenchmarkDotNet with Rhino.Inside.