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

Pixmap optimizations #402

Merged
merged 8 commits into from
Mar 2, 2023
Merged

Pixmap optimizations #402

merged 8 commits into from
Mar 2, 2023

Conversation

3v1n0
Copy link
Collaborator

@3v1n0 3v1n0 commented Mar 1, 2023

Optimize various cases when pixmap icons are used, so that we can reduce their memory impact and do less operations, avoiding to unpack the variants we don't care about.

Pixmaps icons properties may be huge arrays of arrays of bytes, unpacking
them could be expensive and most likely unneeded.

We did this in the past as it made easy to handle the properties, but it's
time to change this, so always use the variants as they are extracting the
child values of the arrays to perform size comparisons, until we actually
need the bytes to perform the RGBA conversion.
This is very likely happening automatically if destruction happens because
the name has been lost, but in case that's not the case, let's cleanup the
stuff before the js GC will remove the whole proxy.
We used to keep the pixmaps variants saved as cached properties of the proxy
but these are just a waste of memory usage once the icon is set, given that
we're not going to re-use them as they are in any case until the icon is
invalidated which happens only in rare cases.

So, once a pixmap is set, unset the cached property and mark it as invalid,
in this way next time an icon is requested we can refresh it if that's
required
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.

1 participant