哪一个更快:十六进制颜色代码或颜色名称? [英] which one is faster: hex color codes or color names?

查看:187
本文介绍了哪一个更快:十六进制颜色代码或颜色名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案

我想知道在CSS中使用十六进制颜色代码或颜色名称是否更快? >

我的猜测是代码会更快,因为名称可能被分配到查找表和参考十六进制代码。



话虽如此,我的猜测是速度差异是完全可以忽略的。



这是我刚刚创建的性能测试。他们是颈部和颈部,虽然十六进制代码似乎只是勉强更快的4/5运行到目前为止:
http://jsperf.com/css-color-names-vs-hex-codes


I just wanted to know if it's faster to use hex color codes or the color names when I want to use it in CSS?

解决方案

My guess is the codes will be faster since the names are probably assigned to a look-up table and reference hex codes anyway.

That being said, my guess is the speed difference will be completely negligible.

Here's a performance test I just created. They're neck and neck, though hex codes seems to be just barely faster on 4/5 runs so far: http://jsperf.com/css-color-names-vs-hex-codes

这篇关于哪一个更快:十六进制颜色代码或颜色名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆