Skip to content

Commit

Permalink
perf: optimize performance by removing spread array (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanyan-Wang authored Jul 20, 2022
1 parent 3bad6c4 commit fe83042
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/path/util/segment-arc-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export function segmentArcFactory(
t = j / sampleSize;

({ x, y } = getPointAtArcSegmentLength(X1, Y1, RX, RY, angle, LAF, SF, X2, Y2, t));
POINTS = [...POINTS, { x, y }];
POINTS = POINTS.concat({ x, y });
LENGTH += distanceSquareRoot(cur, [x, y]);
cur = [x, y];

Expand Down
2 changes: 1 addition & 1 deletion src/path/util/segment-cubic-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function segmentCubicFactory(
t = j / sampleSize;

({ x, y } = getPointAtCubicSegmentLength(x1, y1, c1x, c1y, c2x, c2y, x2, y2, t));
POINTS = [...POINTS, { x, y }];
POINTS = POINTS.concat({ x, y });
LENGTH += distanceSquareRoot(cur, [x, y]);
cur = [x, y];

Expand Down
2 changes: 1 addition & 1 deletion src/path/util/segment-quad-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function segmentQuadFactory(
t = j / sampleSize;

({ x, y } = getPointAtQuadSegmentLength(x1, y1, qx, qy, x2, y2, t));
POINTS = [...POINTS, { x, y }];
POINTS = POINTS.concat({ x, y });
LENGTH += distanceSquareRoot(cur, [x, y]);
cur = [x, y];

Expand Down

0 comments on commit fe83042

Please sign in to comment.