-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
It would be awesome if interceptor resolution were faster for JS objects accessed in Dart via interop classes using the js
package's @JS
annotation.
Background
I'm working on improving the performance of react-dart
, a Dart wrapper for the React JS library.
I recently upgraded the library to use new js
package interop, which resulted in significant performance improvements. Go, js
package!! 🎉
While testing performance, I noticed that lookupAndCacheInterceptor
was taking a significant amount of time.
react-dart
hooks into React JS's rendering via allowInteropCaptureThis
, and unfortunately ends up having to access a large amount of JS objects (the JS this
and its JS properties) during each rendering cycle, which means lots of JS object interceptor resolution.
Idea
One thought I had would be, in lookupAndCacheInterceptor
, to resolve to UnknownJavaScriptObject
when an object's tag
(constructor name) matches the a parameter passed into the @JS
annotation.
However, that'd cause issues if that tag wasn't unique... Thought I'd throw out the idea, though.