estanglerbm opened a new pull request #1026: URL: https://github.com/apache/royale-asjs/pull/1026
Speed up "x as y" and "x is y" where y is an interface, by flattening and caching results from checkInterfaces() inside Language.is(). I don't know how dynamic parent classes can be in Royale, but if they're not too dynamic, then here is my suggestion on how to speed up the incredibly-slow checkInterfaces() in Language.is(). It uses 2-dimensions of WeakMap, on browsers that support it, to flatten and cache the results of checkInterfaces(). To give you an idea about sizes, on a medium-complexity app using Spark and MX, interfaceMap grew to 234 entries (corresponding to leftOperand / classes), and from an informal survey, it appears that many (if not most or all) stayed below 22 entries per class (corresponding to rightOperand / queries-about-interface); many had only 1 entry per class. I know there is a desire to avoid "is" and "as" and use @royaleignorecoercion whenever possible, for performance. That's fine. But there are some places, like UIComponent, where this is causing a real problem. (More on that in another PR.) Existing code has some severe performance problems in some areas, due to checkInterfaces(). For example SimpleCSSValuesImpl.getValue() (in royale core) is called recursively up its parents, in parts of Spark / MX, and can take an incredible amount of time due to the "is IStyleableObject" required check. The goal of this change is make "is" and "as" performant where it is really needed in order to be correct code. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
