Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I now believe that this was a bad API design decision on my part. The original rationale was explained in a blog post on optimizing node size, but I now think I went too far. It's not at all clear from real-world measurements that this approach to minimizing node size at the cost of speed and API complexity is worth it. I mention speed because, of course, it takes time to determine whether the node class can be shared, by comparing the new node class with existing entries in the
BTreeSet
, and this is done every timeNodeBuilder::build
is called. And even if we eventually gather data showing that the size versus speed tradeoff is worthwhile, I think it was a mistake on my part to expose this complexity in the API. I now think it would be better to have a globalNodeClassSet
behind a mutex, as we already had to do for serde support, than to expose this implementation detail to the users; we already know that it caused confusion for at least one potential user.This change does increase the size of
Node
from 32 to 112 bytes, a difference of 80 bytes. I think this is completely acceptable; I remember from chat room discussion during my work onNode
size optimization last year that people were happy when I got the size down to 128 bytes.Looking at it another way, I would rather ship 1.0 without the API complexity of
NodeClassSet
, and figure out how to re-add the optimization in a backward-compatible way later if it's truly necessary, than ship with this API complexity and be stuck with it forever. My work on integrating AccessKit into GTK has led me to refocus on making AccessKit as simple and easy as possible for our users, the toolkits, and that's the primary purpose of this PR.