Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SVG] Optimization of constructPath & Adds unit lengths #5000

Merged
merged 2 commits into from
Jul 8, 2014

Conversation

pramodhkp
Copy link
Contributor

@pramodhkp pramodhkp changed the title Memory optimzation for constructPath [SVG] Memory optimzation for constructPath Jun 24, 2014
@pramodhkp pramodhkp changed the title [SVG] Memory optimzation for constructPath [SVG] Memory optimzation of constructPath, Impl optimization of svg lengths Jun 25, 2014
break;
case OPS.curveTo:
x = args[j + 4];
y = args[j + 5];
arr = [args[j], args[j + 1], args[j + 2], args[j + 3], x, y];
d += 'C ' + arr.join(' ');
d.push( 'C ' , arr.join(' '));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't join it here. Add utility function that will push items with spaces in between. But I would recommend to add space after each item at the end .join(' '). M1 2C 2 3ZM1 0Z does not look right, M 1 2 C 2 3 Z M 1 0 Z - much better

@pramodhkp
Copy link
Contributor Author

Have made the changes. But I didn't add the util function. I have modified the code to reduce the stress on GC, by reducing the number of objects created. Not sure how a util function is helpful here (a single join operation). Would be happy to add if it is necesary.

@pramodhkp
Copy link
Contributor Author

cc @timvandermeij Could I please get a review on this. I think this also fixes the black boxes in tutorial.pdf.

@timvandermeij
Copy link
Contributor

@pramodhkp I have reviewed this and added two comments above. I can indeed confirm that the black boxes in tutorial.pdf are fixed. Nice work!

@pramodhkp
Copy link
Contributor Author

Have made the changes.

@pramodhkp pramodhkp changed the title [SVG] Memory optimzation of constructPath, Impl optimization of svg lengths [SVG] Memory optimzation of constructPath & Adds unit lengths Jul 4, 2014
@pramodhkp pramodhkp changed the title [SVG] Memory optimzation of constructPath & Adds unit lengths [SVG] Optimzation of constructPath & Adds unit lengths Jul 4, 2014
@pramodhkp
Copy link
Contributor Author

cc @timvandermeij

@timvandermeij timvandermeij changed the title [SVG] Optimzation of constructPath & Adds unit lengths [SVG] Optimization of constructPath & Adds unit lengths Jul 8, 2014
@timvandermeij timvandermeij changed the title [SVG] Optimization of constructPath & Adds unit lengths [SVG] Optimzation of constructPath & Adds unit lengths Jul 8, 2014
@timvandermeij timvandermeij changed the title [SVG] Optimzation of constructPath & Adds unit lengths [SVG] Optimization of constructPath & Adds unit lengths Jul 8, 2014
timvandermeij added a commit that referenced this pull request Jul 8, 2014
[SVG] Optimization of constructPath & Adds unit lengths
@timvandermeij timvandermeij merged commit a20c390 into mozilla:master Jul 8, 2014
@timvandermeij
Copy link
Contributor

Thanks for the patch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants