reorganize module
This commit is contained in:
17
_archive/rhai_engine/rhaibook/rust/strings-interner.md
Normal file
17
_archive/rhai_engine/rhaibook/rust/strings-interner.md
Normal file
@@ -0,0 +1,17 @@
|
||||
Strings Interner
|
||||
================
|
||||
|
||||
{{#include ../links.md}}
|
||||
|
||||
|
||||
Because [strings] are immutable (i.e. the use the type [`ImmutableString`] instead of normal Rust `String`),
|
||||
each operation on a [string] actually creates a new [`ImmutableString`] instance.
|
||||
|
||||
A _strings interner_ can substantially reduce memory usage by reusing the same [`ImmutableString`]
|
||||
instance for the same [string] content.
|
||||
|
||||
An [`Engine`] contains a strings interner which is enabled by default
|
||||
(disabled when using a [raw `Engine`]).
|
||||
|
||||
The maximum number of [strings] to be interned can be set via
|
||||
[`Engine::set_max_strings_interned`][options] (set to zero to disable the strings interner).
|
Reference in New Issue
Block a user