Performance issues with DisplayPipeline.DrawLine function

I have noticed that the drawing functions under DisplayPipeline are not at all optimised for performance. Specifically, I am testing DrawLine or DrawLines and I am measuring ~5ms to draw around 4000 arrows in a single viewport. Calling DrawLines does not make a difference. When rotating the view with such a high render time, a noticeable lag is clear to the user.

As a comparison, I created 1 million lines in the Rhino model itself. Rotating the view does not introduce any visible lag, which makes a lot of sense since drawing a few lines with a modern GPU should be very fast.

Is there any way to have better performance when drawing in Rhino’s viewport, perhaps a lower level API or something I am missing?

Hi @Christos_Tsaridis,

To be of help, we will need a sample project, that we can build and run here, that demonstrates the performance issue.

Thanks,

– Dale

Hi @dale ,

I am attaching a Grasshopper script that creates lines and times the DrawLine and DrawLines calls. You can try rotating the viewport to see the effect. If your computer is too fast, try increasing the arrow count.

As for the lines within a Rhino model, I could give you a model but that would be a lot of MB in size. So what I do is create a vertical line, use the Array command with 1000, 1000 in each direction to create 1 million arrows.

Compare the viewport rotation responsiveness between these 2.

test_DrawLine.gh (9.5 KB)