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

reuse storage when parsing multiple glyphs #221

Open
cmyr opened this issue Dec 24, 2021 · 7 comments
Open

reuse storage when parsing multiple glyphs #221

cmyr opened this issue Dec 24, 2021 · 7 comments
Labels
enhancement New feature or request perf

Comments

@cmyr
Copy link
Member

cmyr commented Dec 24, 2021

just noticed this, but currently during parsing we allocate storage for each individual glyph that we parse. It would not be that hard to reuse a single allocation between parsings.

Ultimately this will not be a big win and we shouldn't lose too much sleep over it, but also it should be fairly easy and it shouldn't require breaking changes (at the very least we can just add API to do this internally when we're loading layers.)

One complication is how to share buffers between parsers across threads when we're loading in parallel. 🤔

@cmyr cmyr added enhancement New feature or request perf labels Dec 24, 2021
@madig
Copy link
Collaborator

madig commented Dec 24, 2021

I like. Buffer per thread?

@cmyr
Copy link
Member Author

cmyr commented Dec 26, 2021

yea, something like this. I'm not sure how best to do this with rayon, though..

edit: looks possible, there are some tools for building custom threadpools with thread-local state etc.

@madig
Copy link
Collaborator

madig commented Jan 6, 2022

This would also mean we'd need to stop allocating new sub-buffers while parsing?

@cmyr
Copy link
Member Author

cmyr commented Jan 6, 2022

what sub buffers do we allocate?

@madig
Copy link
Collaborator

madig commented Jan 6, 2022

let mut new_buf = Vec::new(); // borrowck :/

This one for example.

@cmyr
Copy link
Member Author

cmyr commented Jan 6, 2022

mm, that is a funny one, I didn't remember that. That would be unchanged, although in theory we could also have a reusable buffer for that. I don't see any others, do you?

@madig
Copy link
Collaborator

madig commented Jan 6, 2022

That's probably the only one :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request perf
Projects
None yet
Development

No branches or pull requests

2 participants