bazel NestedSet: eliminate size subfield by recording it in memo

This liberates 30 bits of space into which we can record the depth
(in a follow-up).

Janak had suggested getting rid of the size altogether, but this
is no small task because of the 6 existing uses; see discussion in
commit ed9d6390eb78303631c25b3d4776cb07eeded544. The size is also used internally by toList to allocate
an array of the correct size.

Rather than block my progress on that project, this change encodes
the size in the final bytes of the memo array, using a reverse
varint encoding. This would appear to add 1-3 three bytes to each
flattened set, but in practice is almost free as there is usually
slack in the array.

The Usual Benchmark shows a RAM increase of +0.01%.

See saga: commit 841ac61469ed61325acbcb134b6d372316f46540, commit ed9d6390eb78303631c25b3d4776cb07eeded544, commit 867d232f27aa762d4b15e811df18b1939cc1a34b.

PiperOrigin-RevId: 315981081
2 files changed
tree: 0ac6fba26a9e443808e3780edb5e281a2164147e
  1. .bazelci/
  2. examples/
  3. scripts/
  4. site/
  5. src/
  6. third_party/
  7. tools/
  8. .bazelrc
  9. .gitattributes
  10. .gitignore
  11. AUTHORS
  12. BUILD
  13. CHANGELOG.md
  14. CODEOWNERS
  15. combine_distfiles.py
  16. combine_distfiles_to_tar.sh
  17. compile.sh
  18. CONTRIBUTING.md
  19. CONTRIBUTORS
  20. distdir.bzl
  21. ISSUE_TEMPLATE.md
  22. LICENSE
  23. README.md
  24. WORKSPACE
README.md

Bazel

{Fast, Correct} - Choose two

Build and test software of any size, quickly and reliably.

  • Speed up your builds and tests: Bazel rebuilds only what is necessary. With advanced local and distributed caching, optimized dependency analysis and parallel execution, you get fast and incremental builds.

  • One tool, multiple languages: Build and test Java, C++, Android, iOS, Go, and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.

  • Scalable: Bazel helps you scale your organization, codebase, and continuous integration solution. It handles codebases of any size, in multiple repositories or a huge monorepo.

  • Extensible to your needs: Easily add support for new languages and platforms with Bazel's familiar extension language. Share and re-use language rules written by the growing Bazel community.

Getting Started

Documentation

Contributing to Bazel

See CONTRIBUTING.md

Build status