Skip to content

Commit

Permalink
KeyMap Capacity2048
Browse files Browse the repository at this point in the history
  • Loading branch information
ijl committed Apr 24, 2024
1 parent 8a67a76 commit 527a585
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ The input must be valid UTF-8.

orjson maintains a cache of map keys for the duration of the process. This
causes a net reduction in memory usage by avoiding duplicate strings. The
keys must be at most 64 bytes to be cached and 1024 entries are stored.
keys must be at most 64 bytes to be cached and 2048 entries are stored.

The global interpreter lock (GIL) is held for the duration of the call.

Expand Down
4 changes: 2 additions & 2 deletions src/deserialize/cache.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: (Apache-2.0 OR MIT)

use associative_cache::{AssociativeCache, Capacity1024, HashDirectMapped, RoundRobinReplacement};
use associative_cache::{AssociativeCache, Capacity2048, HashDirectMapped, RoundRobinReplacement};
use core::ffi::c_void;
use once_cell::unsync::OnceCell;
use std::hash::Hasher;
Expand Down Expand Up @@ -34,7 +34,7 @@ impl Drop for CachedKey {
}

pub type KeyMap =
AssociativeCache<u64, CachedKey, Capacity1024, HashDirectMapped, RoundRobinReplacement>;
AssociativeCache<u64, CachedKey, Capacity2048, HashDirectMapped, RoundRobinReplacement>;

pub static mut KEY_MAP: OnceCell<KeyMap> = OnceCell::new();

Expand Down

0 comments on commit 527a585

Please sign in to comment.