added flag for useBatchingForLayoutOutputs experiment
Summary: Using a config flag to switch between different implementations of transferring layout outputs - YogaNodeJNI uses multiple access of java fields to pass all properties like width, height, margin etc... - YogaNodeJNIBatching uses a float array to pass all the data in one java field access Reviewed By: davidaurelio Differential Revision: D14378301 fbshipit-source-id: 0da5b28e6a67ad8fd60eb7efe622d9b2deaf177f
This commit is contained in:
committed by
Facebook Github Bot
parent
c11faf2d56
commit
74ce5afd9e
@@ -72,6 +72,8 @@ const short int LAYOUT_MARGIN_START_INDEX = 6;
|
||||
const short int LAYOUT_PADDING_START_INDEX = 10;
|
||||
const short int LAYOUT_BORDER_START_INDEX = 14;
|
||||
|
||||
bool useBatchingForLayoutOutputs;
|
||||
|
||||
class PtrJNodeMap {
|
||||
using JNodeArray = JArrayClass<JYogaNode::javaobject>;
|
||||
std::map<YGNodeRef, size_t> ptrsToIdxs_;
|
||||
@@ -194,7 +196,7 @@ static void YGTransferLayoutOutputsRecursive(
|
||||
|
||||
auto edgesSet = YGNodeEdges{root};
|
||||
|
||||
if (false) {
|
||||
if (useBatchingForLayoutOutputs) {
|
||||
bool marginFieldSet = edgesSet.has(YGNodeEdges::MARGIN);
|
||||
bool paddingFieldSet = edgesSet.has(YGNodeEdges::PADDING);
|
||||
bool borderFieldSet = edgesSet.has(YGNodeEdges::BORDER);
|
||||
@@ -431,16 +433,21 @@ static int YGJNILogFunc(
|
||||
return result;
|
||||
}
|
||||
|
||||
jlong jni_YGNodeNew(alias_ref<jclass>) {
|
||||
jlong jni_YGNodeNew(alias_ref<jobject> thiz, jboolean useBatching) {
|
||||
const YGNodeRef node = YGNodeNew();
|
||||
node->setContext(YGNodeContext{}.asVoidPtr);
|
||||
node->setPrintFunc(YGPrint);
|
||||
useBatchingForLayoutOutputs = useBatching;
|
||||
return reinterpret_cast<jlong>(node);
|
||||
}
|
||||
|
||||
jlong jni_YGNodeNewWithConfig(alias_ref<jclass>, jlong configPointer) {
|
||||
jlong jni_YGNodeNewWithConfig(
|
||||
alias_ref<jclass>,
|
||||
jlong configPointer,
|
||||
jboolean useBatching) {
|
||||
const YGNodeRef node = YGNodeNewWithConfig(_jlong2YGConfigRef(configPointer));
|
||||
node->setContext(YGNodeContext{}.asVoidPtr);
|
||||
useBatchingForLayoutOutputs = useBatching;
|
||||
return reinterpret_cast<jlong>(node);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user