We should give it a try calling `:lists.duplicate` directly but I would be impressed if it yields anything significant. Also, I don't think `String.duplicate` creates N copies, it creates one binary part and uses references to share it along the way.

Finally, another approach is to optimize the most common calls. So we could inline the `repeat` implementation for `i` equals to 2, 4 and 6, avoiding doing any call to any external functions.

Anyway, good job @brunoro on profiling and benchmarking. If those changes do not reveal any significant gain, I would just drop them and leave `String.duplicate`.