-
Notifications
You must be signed in to change notification settings - Fork 13
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
Only store Arc<Glyph> if 'druid' feature is enabled #234
Conversation
I don't believe that ref counted pointers (positively or negatively) influence anything that I am doing with the crate at this stage. Any idea of the performance impact of the change? Intuitively looks like maybe very small benefit with single glyph methods like the glyph getters, but perhaps something more significant with the methods that required RC pointer management across the entire glyph repertoire? |
in theory it means we save one allocation per glyph, and also there is one less pointer jump when accessing any glyph field. In practice I would expect the difference to be negligible. |
Cool change…on the plus side, I learned a lot about the |
@ctrlcctrlv does this change represent an improvement for you? |
@cmyr yes, it simplifies my code a lot, i no longer have to think about whether an API returns an |
i may have learned something by doing it the more complex way, but clearly in Rust when you're writing out a fully qualified trait call like in my case I could not use so that's why i came up with |
@ctrlcctrlv You shouldn't need to worry about ownership; the whole point of This is the fun thing with The only exception here is if you use the |
In any case I understand sometimes just wanting a raw |
This was motivated by seeing some code where a user (@ctrlcctrlv) was jumping through hoops to get around the fact that we were using `Arc`. `Arc` was only used originally because it is important for druid, but I'm not sure it makes sense as a more general design. With this patch, we will only use `Arc` if the user enables the 'druid' feature. The default API now operates on `Glyph` objects directly; where needed there are new _raw methods, behind the 'druid' feature, that operaate on Arc<Glyph>.
This was motivated by seeing some code where a user (@ctrlcctrlv) was
jumping through hoops to get around the fact that we were using
Arc
.Arc
was only used originally because it is important for druid, butI'm not sure it makes sense as a more general design.
With this patch, we will only use
Arc
if the user enables the 'druid'feature.
The default API now operates on
Glyph
objects directly; where neededthere are new _raw methods, behind the 'druid' feature, that operaate on
Arc.
Does this makes sense to folks? @chrissimpkins @ctrlcctrlv @simoncozens are your lives improved in any way by this change?