Skiasharp: [FEATURE] BULK send render calls to canvas

Created on 5 Feb 2020  路  2Comments  路  Source: mono/SkiaSharp

In my app, I do tons of calls to the SKCanvas to draw hundreds of thousands of elements. Getting some lags and fps drop. After some profiling, I've found that a lot of performance is consumed by p/invoke.

Maybe if there will be a bulk draw method that will take data array with function type and arguments we will be able to achieve a huge performance benefit.

Example:

_canvas.BulkDraw(new DrawOp[]{
DrawOp.CreateDrawRect(args...),
DrawOp.CreateDrawText(args...),
...
});

What do you think? Am I right that this trick will improve performance or/and latency if draw call count is more than 1000?

The issue I see with this approach is memory consumption. We will need to create SKPaint for each DrawOP. I see a solution to this problem by the creation of SKPaintPropChangeOp, which will change the props of SKPaint.

Most helpful comment

All 2 comments

Thanks a lot! That's what I need!

Was this page helpful?
0 / 5 - 0 ratings