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

Some preformance fixes #45

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ColleagueRiley
Copy link

  • removed memset calls I don't think filling the structure pointers wasted time more than anything

  • replaced some unnecessary allocation with stack-based arrays

  • replaced strcmp with a for loop so it's slightly faster because ends slightly sooner

  • removed strlen calls in fons__fopen (based on stb_image, it seems these aren't required)

note: if this causes some problems, it'd still be better to replace it with a for loop that iterates through both strings so it's not doing two separate loops per string.

  • made it so if end == NULL it just iterates the string until it reaches '0' instead of setting end to the end. This makes it so it only loops through the string once. (Again, because strlen is doing a loop through the string).

- removed memset calls
I don't think filling the structure pointers wasted time more than anything

- replaced some unnecessary allocation with stack-based arrays

- replaced strcmp with a for loop so it's slightly faster because ends slightly sooner

-  removed strlen calls in fons__fopen (based on stb_image, it seems these aren't required)

note: if this causes some problems, it'd still be better to replace it with a for loop that iterates through both strings so it's not doing two separate loops per string. 

- made it so if end == NULL it just iterates the string until it reaches '0' instead of setting end to the end. This makes it so it only loops through the string once. (Again, because strlen is doing a loop through the string).
src/fontstash.h Outdated Show resolved Hide resolved
(not sure if that's the only one)
…ld the font data for some reason.

 I really think this should be changed somehow.
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.

2 participants