antikythera v0.4.0 Antikythera.TermUtil View Source

Utils for calculating the actual size of terms.

These utils traverse terms and accumulate the size of terms including the actual size of binary.

Link to this section Summary

Functions

Returns the actual size of term in bytes.

Returns whether actual size of term exceeds limit bytes.

Link to this section Functions

Specs

size(term()) :: non_neg_integer()

Returns the actual size of term in bytes.

Link to this function

size_smaller_or_equal?(term, limit)

View Source

Specs

size_smaller_or_equal?(term(), non_neg_integer()) :: boolean()

Returns whether actual size of term exceeds limit bytes.

This is more efficient than deciding by using size/1 because this function returns immediately after exceeding limit, not traverses the entire term.