compact_path_tree

Crates.iocompact_path_tree
lib.rscompact_path_tree
version0.1.0
sourcesrc
created_at2020-07-02 01:15:14.209111
updated_at2020-07-02 01:15:14.209111
descriptionA data structure providing a compact in-memory representation of a tree of paths
homepage
repositoryhttps://github.com/dmarcuse/compact_path_tree.git
max_upload_size
id260469
size26,926
Dana Marcuse (dmarcuse)

documentation

README

compact_path_tree

A simple library for representing an iterable tree of paths efficiently in memory. Rather than storing a PathBuf object for every file, this implementation instead stores a single giant PathBuf and uses relative path components to represent items. For example, this directory structure...

  • outer
    • a
    • b
      • c
      • d
    • e

...could be represented as the following path:

outer/a/../b/c/../d/e

This often saves a significant amount of memory, since every item would otherwise require at least two machine words to store in addition to the contents of the filename, whereas this representation reduces it to around four characters per entry.

This approach has obvious limitations, however. The trees are immutable once constructed, and cannot be sorted in any particular order - the only guarantee is that they can be iterated to provide a depth-first traversal of the paths it represents.

Commit count: 2

cargo fmt