Rhino.Compute is running significantly slower than RhinoCommon?


I made my c# scripts with Rhinocommon initially for testing. The project ran locally and took a bit less than 1 second to complete. I was pleased with the result and then I transferred this project to my backend (asp.net local server, not yet deployed to production) with Rhino.Compute to replace Rhinocommon. However, the performance was drastically worse than I expected, which took about 2 minutes to finish running the project!!

Is this a known performance issue with Rhino.Compute? Or is there some specific setup in the backend I overlooked? Please share your thoughts and help this lost soul out. Thanks!

Here is a screenshot of the Rhino.Compute terminal window.

I’m confused. It looks like the server console says that most of your computations are only taking less than 50 milliseconds. Am I missing something? You said you didn’t setup your server for production? Have you tried setting up a VM using this guide just to check the performance? Rhino - Deployment to Production Servers
Also, is the first response from the server the thing that’s along so long? Or are all requests slow?

Hi Andy, thanks for replying.

The terminal shows just a tiny portion of all the compute methods I used for this project. Yes indeed each method takes about 20ms, but when they added up it’s somewhere near 2 minutes to complete.

The same number of methods running with Rhinocommon would only take less than one second.

Would a VM significantly improve the performance even if the performance isn’t as expected when testing locally?

I understand Compute might run a bit slow at the initial running, so I tried couple more times after the initial run. The time it took to finish the project in other attempts was about the same as the initial run.

Is it possible to attach an example that I can look at on my end?

Yes, absolutely! Let me put together an example project that can simulate and get close to what’s going on in this project, and I’ll share it with you. Thanks for the help!

Hi Andy, please take a look at this sample repo I put together. There is a ghTest.gh file you can test.

First, run the compute server locally, then run the asp backend server which hosts a test API method. Finally, run the ghTest.gh, you should be able to see the difference between the RhinoCommon component and the Compute component.

I’m having trouble building your sample as it looks like you still have references to your own copy of rhino.compute that are being referenced as a dependency, but aren’t included in your repo. For example, see this line in your .sln file. I believe you also have a few references in your other .csproj files too. I tried replacing these on my end, but I believe you may have changed things with your own local build of compute?
Also, I’m not 100% why you need an additional ASP backend server. Are you just trying to register your own endpoints that can be hit via compute? If so, have you had a look at this guide?

From the initial screenshot it looks like you are hitting the compute server a whole lot with different small function calls. Each call to compute in the screenshot requires encoding a curve to json format and sending that information to the server where the curve is decoded from json which results in a ton of overhead.

Many of the function calls are available in our rhino3dm libraries that could be executed locally on the client computer. I would recommend doing this and only call compute for the functions that are not available in rhino3dm.

1 Like

Thanks Andy. I’m making api calls to Rhino.compute from my asp backend server, the backend contains the main logics, they use Compute + rhin3dm to calculate the geometry and return the results.
The example I shared with you is essentially a while loop calling the curvecurve intersection method for 1000 iterations. I compared the method between rhinocommon (about 500ms in gh) and rhino.compute (over 1 minute in gh) and observed the performance.
Probably due to my lack of knowledge of Compute, I was expecting similar performance from both. I’ll give a try implementing some parallel computing and see if that would improve the performance.

I’m following this link from your documentation to test compute locally. I’m using Compute as is with no changes made to it.

I’ll take a deeper look at the reference you suggested.

Hi Steve. I don’t find those methods exist in rhino3dm - Curve.GetLength, Curve.PointAtNormalizedLength, and CurveCurve intersection, etc. Would you point me to them? Thanks!

Hi @yangallen3,

Rhino3dm is based on openNURBS, and openNURBS does not include the features you’ve mentioned.

If you need Curve.GetLength, Curve.PointAtNormalizedLength, and CurveCurve intersection, etc., then you need to use RhinoCommon, in Rhino, or Rhino.Compute.

– Dale

I have a similar issue and here is my ticker
Production Server Response

When the server is idel it will take 25 seconds to start and 8 sec to get the server response ready.
So in total the total response time is 33 seconds
Else it will take only 8 seconds to get the response for a simple http://localhost:8081/sdk call