Skip to content

node/bindnode: reduce verifyCompatibility() calls, consider caching some type info #416

Open
@rvagg

Description

Currently we run verifyCompatibility() on every call to Prototype() and Wrap() (unless it's inferring a schema for you), and it's fairly expensive. Unfortunately we currently can't cache this because we have no place to cache it in.

But, we could consider something like having a bindnode version of schema.Type that you get from a Prototype().Type(). So, a workflow where you do an initial Prototype() and then reuse the resultant Type() for each further Wrap() call. If Wrap() finds a bindnode version of schema.Type it could then assume that verifyCompatibility() has already been performed if the Go type is the same.

Further, we could take the opportunity to cache information about various properties of the Go type(s), such as field names and whether something is a pointer or not. Anything that's a little expensive to do at Wrap() and assemble (on the Prototype). Even things like fieldNameFromSchema() calls could be cached because they're showing up in profiles as a concern.

Metadata

Assignees

Labels

P2Medium: Good to have, but can wait until someone steps up

Type

No type

Projects

  • Status

    🗄️ Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions