Skip to content
New issue

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

BaseObject String(value) 替换为 value.toString() 提高性能 #167

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eos3tion
Copy link

String(value) 即便是对象本身没有实现 toString() 方法的情况下,性能都要低几倍
可参考 https://tc39.es/ecma262/multipage/text-processing.html#sec-string-constructor
会在toString()之前做了多个检查
而 DragonBones 中所有class,都实现了 toString() 方法,性能更高
毕竟这是一个大量调用的方法

`String(value)`  即便是对象本身没有实现 `toString()` 方法的情况下,性能都要低几倍
可参考 https://tc39.es/ecma262/multipage/text-processing.html#sec-string-constructor
会在`toString()`之前做了多个检查
而 DragonBones 中所有class,都实现了 `toString()` 方法,性能更高
毕竟这是一个大量调用的方法
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant