class Crysda::StringPool

Overview

=========================================================================== String Pool for String Interning (Dictionary Encoding) Reduces memory for categorical columns with repeated values

Defined in:

crysda/columns.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(initial_capacity : Int32 = 64) #

[View source]

Instance Method Detail

def beneficial?(total_strings : Int32) : Bool #

Check if interning would be beneficial (high repetition ratio)


[View source]
def clear #

[View source]
def hit_ratio : Float64 #

Statistics


[View source]
def intern(str : String) : String #

Intern a string - returns the canonical instance


[View source]
def intern(str : String | Nil) : String | Nil #

Intern a nullable string


[View source]
def size : Int32 #

Number of unique strings in pool


[View source]