After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 495077 - Property caching scheme does not work
Property caching scheme does not work
Status: RESOLVED FIXED
Product: pyatspi2
Classification: Applications
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Eitan Isaacson
Li Yuan
Depends on:
Blocks: 487189
 
 
Reported: 2007-11-08 19:06 UTC by Eitan Isaacson
Modified: 2019-03-27 20:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
New caching scheme (5.24 KB, patch)
2007-11-08 19:17 UTC, Eitan Isaacson
needs-work Details | Review
New caching scheme (6.69 KB, patch)
2007-11-08 20:34 UTC, Eitan Isaacson
committed Details | Review

Description Eitan Isaacson 2007-11-08 19:06:25 UTC
Currently in pyatspi we have an issue with the property caching scheme: Every time a paperweight is garbage collected (which happens all the time if you are listening for events), it will delete the cache entry for a certain accessible, even if we are holding a paperweight for that accessible somewhere else. In an application like Orca, which listens to a lot of events, this means that we are virtually not caching.
Comment 1 Eitan Isaacson 2007-11-08 19:17:16 UTC
Created attachment 98782 [details] [review]
New caching scheme

This patch introduces a global dictionary with weak referenced values. The key is a given accessible's hash, and the value is an old-style class (_PropertyCache) instance that could be annotated with cached info. The dictionary's reference to the cache values is weak, the strong reference comes from slots in the accessible paperweights themselves. 

So while one or more paperweights of the same accessible are alive, the dictionary entry remains, when all paperweights get deleted, the entry disappears automatically, which is a good thing since the hash values are typically recycled for a new and different accessible.

This patch is especially edgy since I introduce parent caching, which gives a large performance boost to Orca. I was at first scared of cyclical references, But so far it works remarkably well, but I might have overlooked something in that, so please look closely at the possibilities of mess-up with parent caching.
Comment 2 Eitan Isaacson 2007-11-08 20:34:04 UTC
Created attachment 98785 [details] [review]
New caching scheme

This patch adds user_data with global scope (ie. two paperweights of the same accessible will have identical user_data).
Comment 3 Peter Parente 2007-11-16 21:14:04 UTC
Comment on attachment 98785 [details] [review]
New caching scheme

Yes. This looks like it will work. Needs some cleanup before commit, but the idea is sound.
Comment 4 Eitan Isaacson 2007-11-30 17:17:32 UTC
I committed this a day before Peter's comment. Oops.
Peter, is there any specific cleanup you had in mind?
Comment 5 Peter Parente 2007-11-30 17:20:44 UTC
Getting rid of debugging info. (prints)
Comment 6 Eitan Isaacson 2008-05-06 19:43:28 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.