Skip to content

Commit a47c4a8

Browse files
committed
doc: add a notice that unchecked resolving is faster for BufferBackend
1 parent 233bc6c commit a47c4a8

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

src/lib.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,27 @@
8585
//!
8686
//! | **Property** | **BucketBackend** | **StringBackend** | **BufferBackend** | | Explanation |
8787
//! |:-------------|:-----------------:|:-----------------:|:-----------------:|:--|:--|
88-
//! | Fill | 🤷 | 👍 | ⭐ | | Efficiency of filling an empty string interner. |
89-
//! | Fill Duplicates | 1) | 1) | 1) | | Efficiency of filling a string interner with strings that are already interned. |
90-
//! | Resolve | ⭐ | 👍 | 👎 | | Efficiency of resolving a symbol of an interned string. |
91-
//! | Allocations | 🤷 | 👍 | ⭐ | | The number of allocations performed by the backend. |
92-
//! | Footprint | 🤷 | 👍 | ⭐ | | The total heap memory consumed by the backend. |
93-
//! | Iteration | ⭐ | 👍 | 👎 | | Efficiency of iterating over the interned strings. |
94-
//! | | | | | | |
95-
//! | Contiguous | ✅ | ✅ | ❌ | | The returned symbols have contiguous values. |
96-
//! | Stable Refs | ✅ | ❌ | ❌ | | The interned strings have stable references. |
97-
//! | Static Strings | ✅ | ❌ | ❌ | | Allows to intern `&'static str` without heap allocations. |
88+
//! | Fill | 🤷 | 👍 | ⭐ | | Efficiency of filling an empty string interner. |
89+
//! | Fill Duplicates | 1) | 1) | 1) | | Efficiency of filling a string interner with strings that are already interned. |
90+
//! | Resolve | ⭐ | 👍 | 👎 | | Efficiency of resolving a symbol of an interned string. |
91+
//! | Resolve Unchecked | 👍 | 👍 | ⭐ 2) | | Efficiency of unchecked resolving a symbol of an interned string. |
92+
//! | Allocations | 🤷 | 👍 | ⭐ | | The number of allocations performed by the backend. |
93+
//! | Footprint | 🤷 | 👍 | ⭐ | | The total heap memory consumed by the backend. |
94+
//! | Iteration | ⭐ | 👍 | 👎 | | Efficiency of iterating over the interned strings. |
95+
//! | | | | | | |
96+
//! | Contiguous | ✅ | ✅ | ❌ | | The returned symbols have contiguous values. |
97+
//! | Stable Refs | ✅ | ❌ | ❌ | | The interned strings have stable references. |
98+
//! | Static Strings | ✅ | ❌ | ❌ | | Allows to intern `&'static str` without heap allocations. |
9899
//!
99100
//! 1. Performance of interning pre-interned string is the same for all backends since
100101
//! this is implemented in the `StringInterner` front-end via a `HashMap` query for
101102
//! all `StringInterner` instances.
102103
//!
104+
//! 2. `BufferBackend` is slow with checked resolving because its internal representation
105+
//! is extremely sensible to the correctness of the symbols, thus a lot of checks
106+
//! are performed. If you will only use symbols probided by the same instance of
107+
//! `BufferBackend`, `resolve_unchecked` is a lot faster.
108+
//!
103109
//! ### Legend
104110
//!
105111
//! | ⭐ | **best performance** | 👍 | **good performance** | 🤷 | **okay performance** | 👎 | **bad performance** |

0 commit comments

Comments
 (0)