View Source Antikythera.TermUtil (antikythera v0.5.1)

Utils for calculating the actual size of terms.

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

Summary

Functions

Returns the actual size of term in bytes.

Returns whether actual size of term exceeds limit bytes.

Functions

@spec 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
@spec 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.