Effect CommunityEC
Effect Communityβ€’3y agoβ€’
46 replies
imagio

Overhead of Running a New Effect in a React-Native App

How much overhead is there to run a new effect?

I'm profiling my react-native app (the hermes profiler is quite unreliable so this may be nothing) and I've noticed that running a simple sync effect takes more time than I would expect. As a bridge to react I run a sync effect to grab a service like so:

    get Auth(): IAuthService {
        return EffectRuntimeCtx.getDefault()!.getServiceSync(AuthServiceTag)
    }


where getServiceSync is simply pipe(serviceTag, runSync(myRuntime)). That appears to take a non-trivial amount of time (a few ms). I'm going to memoize it but I'm curious about the expected amount of overhead to run* an effect.
Was this page helpful?