Skip to content

Commit

Permalink
Add tracing to when SO libraries are loaded
Browse files Browse the repository at this point in the history
Summary:
Currently, loading SO libraries is pretty expensive. While they are triggered due to accessing `ReadableNativeArray`. However, with preloader experiments, this block seems to move around and is loaded when the first dependent class loads it.

Also, as a part of D10108380, this will be moved again.

Adding a trace to keep track of where it moves.

Reviewed By: achen1

Differential Revision: D9890280

fbshipit-source-id: 4b331ef1d7e824935bf3708442537349d2d631d0
  • Loading branch information
axe-fb authored and facebook-github-bot committed Oct 1, 2018
1 parent 9acebcd commit 90091a7
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@

package com.facebook.react.bridge;

import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;

import com.facebook.soloader.SoLoader;
import com.facebook.systrace.Systrace;

public class ReactBridge {
private static boolean sDidInit = false;
public static void staticInit() {
// No locking required here, worst case we'll call into SoLoader twice
// which will do its own locking internally
if (!sDidInit) {
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "ReactBridge.staticInit::load:reactnativejni");
SoLoader.loadLibrary("reactnativejni");
sDidInit = true;
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
}
}

0 comments on commit 90091a7

Please sign in to comment.