RESOLVED FIXED 27956
AX: roleValue should be cached for performance
https://bugs.webkit.org/show_bug.cgi?id=27956
Summary AX: roleValue should be cached for performance
chris fleizach
Reported 2009-08-03 15:11:42 PDT
a lot of calls to roleValue can be made in the course of an AX object's lifetime. i think it would be beneficial to cache that value
Attachments
patch (18.97 KB, patch)
2009-08-03 15:32 PDT, chris fleizach
no flags
patch (9.12 KB, patch)
2009-08-03 16:43 PDT, chris fleizach
no flags
patch (9.64 KB, patch)
2009-08-04 10:14 PDT, chris fleizach
eric: review+
chris fleizach
Comment 1 2009-08-03 15:13:10 PDT
my initial testing shows a 5.1% speedup by caching the role value
chris fleizach
Comment 2 2009-08-03 15:32:06 PDT
testing was done by navigating a web page and totaling the time spent in copyAttributeValue. Of course roleValue is called in other places, so this speedup will be felt in other places as well
chris fleizach
Comment 3 2009-08-03 15:32:20 PDT
Mark Rowe (bdash)
Comment 4 2009-08-03 15:41:47 PDT
Comment on attachment 34009 [details] patch > Index: WebCore/accessibility/AccessibilityImageMapLink.cpp > =================================================================== > --- WebCore/accessibility/AccessibilityImageMapLink.cpp (revision 46732) > +++ WebCore/accessibility/AccessibilityImageMapLink.cpp (working copy) > @@ -43,9 +43,10 @@ namespace WebCore { > using namespace HTMLNames; > > AccessibilityImageMapLink::AccessibilityImageMapLink() > - : m_areaElement(0), > - m_mapElement(0) > + : m_areaElement(0) > + , m_mapElement(0) > { > + m_role = WebCoreLinkRole; > } Initialization of this form should happen in the initialization list rather than via assignment in the constructor body.
chris fleizach
Comment 5 2009-08-03 15:42:54 PDT
m_role is a protected variable in AccessibilityObject. When i tried to initialize it in the constructor list, it wouldn't compile
chris fleizach
Comment 6 2009-08-03 15:49:07 PDT
specifically /Volumes/data/WebKit/WebCore/accessibility/AccessibilityImageMapLink.cpp:48: error: class ‘WebCore::AccessibilityImageMapLink’ does not have any field named ‘m_role’
chris fleizach
Comment 7 2009-08-03 16:09:06 PDT
Comment on attachment 34009 [details] patch obsoleting this patch
chris fleizach
Comment 8 2009-08-03 16:43:27 PDT
Eric Seidel (no email)
Comment 9 2009-08-04 08:59:45 PDT
Comment on attachment 34018 [details] patch setRoleValue would normally take an argument. Maybe initializeRoleValues() or determineRoleValues()? Do determineRoleValue() and determineAriaRole() need to be separate, or can they just be both part of a determinRoleValue()? Is this something we could just do on first access to roleValue()? or do we need to call this explicitly?
chris fleizach
Comment 10 2009-08-04 09:07:03 PDT
i think we can re-word some of these methods
chris fleizach
Comment 11 2009-08-04 10:07:07 PDT
unfortunately, we have to determine the role at initialization because too many methods rely on roleValue() to be const (so we can't set the role in roleValue() the first time someone asks for it)
chris fleizach
Comment 12 2009-08-04 10:14:02 PDT
chris fleizach
Comment 13 2009-08-04 10:14:35 PDT
changed set*Role to updateAccessibilityRole()
Eric Seidel (no email)
Comment 14 2009-08-06 18:15:36 PDT
Comment on attachment 34073 [details] patch Looks OK.
chris fleizach
Comment 15 2009-08-06 18:57:04 PDT
Note You need to log in before you can comment on or make changes to this bug.