Canvas Rendering Profiling

From Inkscape Wiki
Jump to navigation Jump to search

Objetive

This doc try help devs undertand the output of the canvas rendering flag enabled pefdormance output.

Backgroud

Current Inkscape rendring process is done in main thread, except filters that has some multitherading capabilities, but relay on main thread at the end.

A inkscape idle process is fired each time we modify the data to show, some actions can produce consecutive proceses like moving a object.

We consider a iddle process the time since something change in Inkscape and is marked to render to the next finished state with the changes reflected on screen.

Each Inkscape rendering idle process is done in blocks of start-end, and they not switch between. This iddle proceses can be paused in middle giving control to Inkscape to add more zones to render, after, the process continue till, finaly, all canvas is full render, when the log give the most important data.

There is a special thing also, in middle of a idle process, when we count one loop more and add a control to main thread to process more request and finsh after the idle process, we can call to updateNow, that make one loop more inside the idle process and when finish continue with the rest of the idle process.

This profiling help you to compare time of the iddle process of a Inkacape operation.

One thing to do is make a script to allow devs to follow and compare with a fixed guide. I use this one https://gitlab.com/inkscape/inkscape/merge_requests/925 but I miss node selection and deselection

Woring with it

To enable dev need to uncomment the line https://gitlab.com/inkscape/inkscape/blob/master/src/display/sp-canvas.cpp#L61

♯define DEBUG_PERFORMANCE 1;

This is good to compare improvements with other branches or commits.

Once done, on each iddle process you get diferent ouput, to explain I try so fill a bit background:

This is a example of a iddle process:

[XXXX] ::::::::::::::::::::::::::::::::::::::: <- end of previous idle process

[2359] launched 1.701941

[2359] start updateNow(): 0.000166 at 1.702107

[2359] end updateNow(): 0.001205 at 1.703146

[2359] start loop 1 in split 1 at 1.761680

[2359] finished

[2359] loops 1

[2359] splits 1

[2359] duration 0.059806

[2359] total 1.761747 (toggle outline mode to reset)

[2359] :::::::::::::::::::::::::::::::::::::::


[number]: Unique idle id

updateNow: If function updateNow() is fired after launch, this not happend always but can happens multiple times

Loops: Iddle process can be paused (counting one loop more) without full render, because process is a bit long and we want to give control to main loop to update requests and mark other zones to render.

Splits: Number of diferent independent zones renderer in iddle process.

Duration: Just finished iddle process time from launched.

Total: Acumulative duration to allow multiple operation comparsions. To resert, put a moment the document in outline mode.

To take account

In rendering is very important and can change results from diferent systems/configuration

  • Canvas size (Is maximized? How resolution has your Screen? Is HiDPI scaling enabled?)
  • Number of tiles in preferences-> rendering. Inkscape by default use 16, to share values I usualy use this setings (but test code in more values specialy very low values, I use 1...)
  • Cache of rendering in preferences-> rendering, Inkscape use 64MB by default.
  • We run GDB or not
  • Current process running

Also is important we can get rendering gap on the same operands by the current status of the machine, the maximun gap I find is < 0.1 in similar envirment.