A proposal to add a new built-in function (BIF) `erlang:atom_prefix/2` to Erlang/OTP that checks whether an atom starts with a given prefix by comparing directly against the atom table's internal UTF-8 bytes. The current approach requires converting atoms to lists or binaries first, causing unnecessary heap allocations and GC pressure. The proposed BIF would be zero-allocation and zero-GC. The pattern already appears in at least 5 places in OTP and 5 places in Elixir, making it a potentially broadly useful addition.

1m read timeFrom erlangforums.com
Post cover image

Sort: