Add YogaNodeProperties implementation based on ByteBuffer

Summary:
@public
Adds an implementation of `YogaNodeProperties` that accesses style and layout properties using a `ByteBuffer` rather than JNI calls.
We hope for a speed improvement.

This needs further cleanup after experimenting, e.g. to codegen the offsets.

Reviewed By: pasqualeanatriello

Differential Revision: D8911723

fbshipit-source-id: 3c24b57eb545155878896ebb5d64d4553eb6bedc
This commit is contained in:
David Aurelio
2018-07-30 09:30:51 -07:00
committed by Facebook Github Bot
parent b1821ab4cd
commit 3499e2e0ef
29 changed files with 2034 additions and 979 deletions

View File

@@ -0,0 +1,54 @@
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
*/
package com.facebook.yoga;
import java.util.Arrays;
public class TestParametrization {
public static Iterable<NodeFactory> nodeFactories() {
return Arrays.asList(
new NodeFactory() {
@Override
public YogaNode create() {
return new YogaNode();
}
@Override
public YogaNode create(YogaConfig config) {
return new YogaNode(config);
}
@Override
public String toString() {
return "JNI";
}
},
new NodeFactory() {
@Override
public YogaNode create() {
return new YogaNode(true);
}
@Override
public YogaNode create(YogaConfig config) {
return new YogaNode(true, config);
}
@Override
public String toString() {
return "ByteBuffer";
}
});
}
public interface NodeFactory {
YogaNode create();
YogaNode create(YogaConfig config);
}
}