Possible solutions to slow fabric Path object instantiation #10117
Replies: 4 comments 8 replies
-
Can you paste here one long to parse path? |
Beta Was this translation helpful? Give feedback.
-
The slow path
TODO create a path doing const p = new Path(longPath); inspect performances and paste result here Compare performances with 5.x |
Beta Was this translation helpful? Give feedback.
-
@asturur seems like its atleast 10 to 11x times slower Fabric 6.4.1: https://jsfiddle.net/k3cxjzhn/4/ |
Beta Was this translation helpful? Give feedback.
-
Fixed by: #10123 |
Beta Was this translation helpful? Give feedback.
-
Hello!
I am using perfect-freehand with Fabric and everything works fine except that the instantiation of the fabric Path object takes way too long.
For performance's sake i create a new custom brush and do something like this on mouse movement:
and then on mouse release i finalize the path, and smooth out the edges:
I am new to the library and I dont know if there's a better way (i would want to use perfect-freehand always instead of using canvas draw first), but this works atleast for now.
The Problem:
The
path-creation
part of the finalize stage is taking way too long. If i hold my mouse and draw a lot, i end up with lots of points, even then the getStroke() fromperfect-freehand
only takes a fraction of the time whereas the a very big part of the smoothing out process is taken by the fabric.Path initialization.Is there a way around this? Sorry if my code looks extremely bad and stuff.
Beta Was this translation helpful? Give feedback.
All reactions