Paper.js: Performance issue with zooming on complex shapes

Created on 19 Mar 2019  路  4Comments  路  Source: paperjs/paper.js

Description/Steps to reproduce

  1. Create a path on the sketch (clicking and dragging)
  2. Zoom in on shape
  3. As you zoom in, frames drop and can potentially crash browser

Link to reproduction test-case

Sketch

Expected result

Smooth transitions well zooming in on complex shapes


What options do we have for rendering only objects in view? Does anyone have work arounds for this?

performance bug

Most helpful comment

@jsbroks, thanks for the clear reproduction example, it makes my browser crash too now.

Based on your investigation, I will try to see if there is something that we can improve to prevent that.

All 4 comments

Hi, I can't reproduce the issue, this seems pretty smooth to me (Windows 10/Chrome 72).
What device/browser are you using ?
Can you try to make the reproduction case more obvious by including the shape drawing in the code instead of asking us to draw it ?

Test the issue in Windows 10/Ubuntu 18.04 on both FireFox 65.0.1 and Chrome 72.0.3626.121 .

Here is one with an example path once you get to around 0.3 on the scale it starts to freeze up

Video

Edit: Strokes causes the issue to occur earlier, but if you add enough shapes it will persist

@sasensi So I figured out what the problem is for my use case, which is probably related to the issue above.

I have many CompoundPath's inside a group and when zooming in it calls the draw function on each Item. This includes the Group class its self... and because the group object does not have the function _canCompose() defined, it defaults to false. This causes the process function to be called which has huge performance implications on large scales.

Is it safe to say we can set the _canComposite() of a group to true?

@jsbroks, thanks for the clear reproduction example, it makes my browser crash too now.

Based on your investigation, I will try to see if there is something that we can improve to prevent that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hapticdata picture hapticdata  路  5Comments

Mark12870 picture Mark12870  路  3Comments

nicholaswmin picture nicholaswmin  路  3Comments

arel picture arel  路  3Comments

techninja picture techninja  路  4Comments