Currently we use Stream.cycle/1 and Enum.reduce_while/3 for the implementation of the masking function.
This is probably very suboptimal in terms of speed and memory consumption. If I understand Elixir/Erlang performance correctly, binary matches are always to be preferred for speed/memory. Also we're only doing the xor of 1 byte (unsigned big integer) at a time and we could be doing it with up to four bytes (the size of the mask)
Currently we use
Stream.cycle/1andEnum.reduce_while/3for the implementation of the masking function.This is probably very suboptimal in terms of speed and memory consumption. If I understand Elixir/Erlang performance correctly, binary matches are always to be preferred for speed/memory. Also we're only doing the xor of 1 byte (unsigned big integer) at a time and we could be doing it with up to four bytes (the size of the mask)