MapBuffer.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. #pragma once
  8. #include <string>
  9. namespace facebook {
  10. namespace react {
  11. /**
  12. * MapBuffer is an optimized map format for transferring data like props between
  13. * C++ and other platforms The implementation of this map is optimized to:
  14. * - be compact to optimize space when sparse (sparse is the common case).
  15. * - be accessible through JNI with zero/minimal copying via ByteBuffer.
  16. * - be Have excellent C++ single-write and many-read performance by maximizing
  17. * CPU cache performance through compactness, data locality, and fixed offsets
  18. * where possible.
  19. * - be optimized for iteration and intersection against other maps, but with
  20. * reasonably good random access as well.
  21. * - Work recursively for nested maps/arrays.
  22. * - Supports dynamic types that map to JSON.
  23. * - Don't require mutability - single-write on creation.
  24. * - have minimal APK size and build time impact.
  25. */
  26. class MapBuffer {
  27. public:
  28. MapBuffer();
  29. virtual ~MapBuffer();
  30. };
  31. } // namespace react
  32. } // namespace facebook