What is the time complexity of code points?


I have a pretty basic question, what is the time complexity of code points?
In other languages ive used, a lookup table is employed to provide constant time for utf-8 to binary/integer conversion, is it safe to make this assumption about Elixir?

If you dont know what I mean its the ability to “cast” characters to their UTF-8 integer representation shown below :slight_smile:

# returns 97

Thank you for your help!

Hi @H8rs ? is a compile time transformation. That’s why it only works on literal values like a. This means that there is no cost at all because by the time your code is actually running the value is already 97.


oh awesome, i feel kinda silly for not realising that would be done at compile time/

Thank you for your rapid reply :slight_smile:

No problem, welcome to the forum!

1 Like