Skip to content

Consider using an alternative to std::function #92

Description

@dunhor

There's a number of places where we voluntarily use std::function to hold callbacks (as opposed to e.g. JSI where usage is forced). This is sub-optimal from a binary size perspective since std::function prevents a lot of things from getting folded together. The root problem seems to be std::function's target_type and target functions. These require the object to hold RTTI info on the underlying function object - even though I've never seen or heard of anyone needing/wanting these functions - which then causes constructors & v-tables to need to be unique causing a whole host of functions to be non-foldable.

It would be relatively simple to substitute in our own std::function-like type that does not require this RTTI info, though it's not immediately clear if it would be worth it. Could be a good investigation, though.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestreact-nativeBugs/issues/feature asks for react native generation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions