Skip to content

Commit 9a053fc

Browse files
mdvaccafacebook-github-bot
authored andcommitted
Create base MapBuffer class and tests
Summary: This diff creates the base classes for MapBuffer and its tests Reviewed By: shergin Differential Revision: D15550730 fbshipit-source-id: a5a47edebd7c3e1b8b2c3ad2006aee0f8bdb7866
1 parent bc6dd6b commit 9a053fc

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
#include "MapBuffer.h"
9+
10+
namespace facebook {
11+
namespace react {
12+
13+
MapBuffer::MapBuffer() {}
14+
15+
MapBuffer::~MapBuffer() {}
16+
17+
} // namespace react
18+
} // namespace facebook
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
#pragma once
9+
10+
#include <string>
11+
12+
namespace facebook {
13+
namespace react {
14+
15+
/**
16+
* MapBuffer is an optimized map format for transferring data like props between
17+
* C++ and other platforms The implemenation of this map is optimized to:
18+
* - be compact to optimize space when sparse (sparse is the common case).
19+
* - be accessible through JNI with zero/minimal copying via ByteBuffer.
20+
* - be Have excellent C++ single-write and many-read performance by maximizing
21+
* CPU cache performance through compactness, data locality, and fixed offsets
22+
* where possible.
23+
* - be optimized for iteration and intersection against other maps, but with
24+
* reasonably good random access as well.
25+
* - Work recursively for nested maps/arrays.
26+
* - Supports dynamic types that map to JSON.
27+
* - Don't require mutability - single-write on creation.
28+
* - have minimal APK size and build time impact.
29+
*/
30+
class MapBuffer {
31+
public:
32+
MapBuffer();
33+
virtual ~MapBuffer();
34+
};
35+
36+
} // namespace react
37+
} // namespace facebook
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
#include <memory>
9+
10+
#include <gtest/gtest.h>
11+
12+
TEST(MapBufferTest, testSomething) {
13+
// TODO
14+
}

0 commit comments

Comments
 (0)