summaryrefslogtreecommitdiffstats
path: root/vendor/kstring/README.md
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/kstring/README.md
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/kstring/README.md')
-rw-r--r--vendor/kstring/README.md58
1 files changed, 58 insertions, 0 deletions
diff --git a/vendor/kstring/README.md b/vendor/kstring/README.md
new file mode 100644
index 000000000..91828d01d
--- /dev/null
+++ b/vendor/kstring/README.md
@@ -0,0 +1,58 @@
+KString
+===========
+
+> Key String: Optimized for map keys.
+
+[![Crates Status](https://img.shields.io/crates/v/kstring.svg)](https://crates.io/crates/kstring)
+
+## Background
+
+Considerations:
+- Large maps
+- Most keys live and drop without being used in any other way
+- Most keys are relatively small (single to double digit bytes)
+- Keys are immutable
+- Allow zero-cost abstractions between structs and maps (e.g. no allocating
+ when dealing with struct field names)
+
+Ramifications:
+- Inline small strings rather than going to the heap.
+- Preserve `&'static str` across strings (`KString`),
+ references (`KStringRef`), and lifetime abstractions (`KStringCow`) to avoid
+ allocating for struct field names.
+- Use `Box<str>` rather than `String` to use less memory.
+
+Features
+- `max_inline`: Instead of aligning the inline-string for performance (15 bytes + length on 64-bit), use the full width (22 bytes on 64-bit)
+- `arc`: Instead of using `Box<str>`, use `Arc<str>`. Note: allocations are fast enough that this can actually slow things down for small enough strings.
+
+Alternatives
+- [`smol_str`](https://crates.io/crates/smol_str)
+ - Size of String
+ - Always uses `Arc` instead of `Box`
+ - Always inlines 22 bytes
+ - Whitespace-only optimizations
+- [`smartstring`](https://crates.io/crates/smartstring)
+ - Size of String
+ - Allows mutability at the cost of relying on implementation details of `String`
+ - Always inlines 23 bytes
+- [`compact_str`](https://crates.io/crates/compact_str)
+ - Size of String
+ - Always uses `Arc` instead of `Box`
+ - Inlines 22-23 bytes, depending on implementation
+
+## License
+
+Licensed under either of
+
+ * Apache License, Version 2.0, (http://www.apache.org/licenses/LICENSE-2.0)
+ * MIT license (http://opensource.org/licenses/MIT)
+
+at your option.
+
+### Contribution
+
+Unless you explicitly state otherwise, any contribution intentionally
+submitted for inclusion in the work by you, as defined in the Apache-2.0
+license, shall be dual licensed as above, without any additional terms or
+conditions.