8000 Remove trailing zeroes in path string output by mdboom · Pull Request #4825 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Remove trailing zeroes in path string output #4825

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

Merged
merged 1 commit into from
Jul 30, 2015

Conversation

mdboom
Copy link
Member
@mdboom mdboom commented Jul 30, 2015

This fixes a performance problem introduced in 1f0e4a in that the path strings in SVG, PDF and PS include trailing zeroes in the numbers, making the file sizes significantly larger. This truncates any trailing zeroes or unnecessary decimal places.

I'm a little lost by which branch I should be making this against. It's a low-risk bugfix, so should go into whatever will end up in the most places.


// Delete trailing zeros and decimal point
char *q = str;
for (; *q != 0; ++q) {
Copy link
Member

Choose a reason for hiding this comment

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

Are we guarranteed a null-terminated string?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. PyOS_double_to_string and PyOS_ascii_formatd return NULL-terminated strings. The docs don't actually say that, but since they don't return a length, I don't see how one could expect anything else.

@tacaswell
Copy link
Member

Targeting to the right place then.

@tacaswell
Copy link
Member

Test failure is unrelated (latex related sillyness), merging.

tacaswell added a commit that referenced this pull request Jul 30, 2015
PRF: Remove trailing zeroes in path string output
@tacaswell tacaswell merged commit afc0280 into matplotlib:master Jul 30, 2015
@mdboom mdboom deleted the svg-size branch November 9, 2015 02:35
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
0