Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

ps_map

container.ps_map

(PK 
type
:
Type, V 
type
:
Type)
:
Map PK, V
 is
[Private constructor]
[Module base]
ps_map -- a partially sorted map

ps_map is a persistent map from an ordered key PK to a value V. This map is
generally well-behaved with respect to cumulative and average performance.

The keys and values are stored in arrays consisting of sorted sub-arrays,
with sub-arrays corresponding to the 1-bits in the binary representation
of the size.

This results in cumulative memory usage in O(size log² size), worst-case
lookup time in O(log² size) and average addition time in O(1) and worst-case
addition time in O(size log² size).

WARNING: Due to the high worst-case time for addition, this structure should
not be used in situations when adding a single element repeatedly to the same
instance of ps_map is performance critical. If the resulting map's size n is a
power of 2, this will trigger the worst-case addition time resulting in
O(m*n log² n) for adding an element m times.

This constructor is for internal use only, to create instance of ps_map, use
ps_map PK V without arguments.

Type Parameters

PK
[Module base]
key type
V
[Module base]
value type

Fields

size
 i32
[Redefinition of  container.Map.size]
[Module base]
the number of key and value pairs in this map.

redefines:

0.095dev (2025-08-15 12:02:22 GIT hash 301b5b75e77076d091b38f555473f9f0e31e5b5c built by fridi@fzen)