We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
a.b.c.d 性能比 a['b']['c']['d'] 要高,因为a['b'] 这种方式其实还需要考虑 [] 中的内容作为一个变量的情况,所以多了对变量的计算。至于在ast层面上来看,两个表达式解析出来的结果前者会切割成7块,分别是a . b . c . d , 而后者则需要匹配左右括弧,多出一些匹配操作,由于要考虑[] 中会存在变量的情况,还需要通过作用域链寻找变量。整体上来说就比a.b.c.d 要慢。
a.b.c.d
a['b']['c']['d']
a['b']
[]
a
.
b
c
d
The text was updated successfully, but these errors were encountered:
No branches or pull requests
a.b.c.d
性能比a['b']['c']['d']
要高,因为a['b']
这种方式其实还需要考虑[]
中的内容作为一个变量的情况,所以多了对变量的计算。至于在ast层面上来看,两个表达式解析出来的结果前者会切割成7块,分别是a
.
b
.
c
.
d
, 而后者则需要匹配左右括弧,多出一些匹配操作,由于要考虑[]
中会存在变量的情况,还需要通过作用域链寻找变量。整体上来说就比a.b.c.d
要慢。The text was updated successfully, but these errors were encountered: