Is there a difference in the speed a browser can parse a colour?
for example, the colour red, i could use the following css:
.red
{
color:red;
co
red
is the easiest to parse, but will require a lookup in to table to get the actual value to be used.
#ff0000
is the next easiest to parse, requires 3 Text -> Int conversions to get the actual value.
rgb(255,0,0)
is the most difficult to parse, and still requires the 3 Text -> Int conversions to get the actual value.
The second is likely the fastest overall since the red
method (likely) requires a hashing operation (another Text -> Int conversion, just not what we normally think about), and then the lookup. Also the red
token can be arbitrarily long compared to #ff0000
.
I won't comment on the micro-optimization aspect or its wisdom.