Skip to content

Faster resolution of interceptors for @JS() classes #26247

@greglittlefield-wf

Description

@greglittlefield-wf

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.

screen shot 2016-04-08 at 4 31 10 pm

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.

Metadata

Metadata

Assignees

Labels

area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.type-enhancementA request for a change that isn't a bugweb-js-interopIssues that impact all js interop

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions