The Wayback Machine - https://web.archive.org/web/20201014224546/https://github.com/Tencent/xLua/issues/760
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

【建议】reflectwrap可否用到的才创建delegate? #760

Open
sFisherE opened this issue Jun 19, 2020 · 2 comments
Open

【建议】reflectwrap可否用到的才创建delegate? #760

sFisherE opened this issue Jun 19, 2020 · 2 comments

Comments

@sFisherE
Copy link

@sFisherE sFisherE commented Jun 19, 2020

现在是一旦在lua中引用了该类型,则就会把所有的方法、字段、属性创建delegate,即makeReflectionWrap。希望作者可以考虑一下,用到的时候再去创建,因为大部分字段都是用不到的,减少内存的浪费。

@chexiongsheng
Copy link
Collaborator

@chexiongsheng chexiongsheng commented Aug 7, 2020

但是是反射获取某个方法或者属性就很耗时。这个做法可能cpu方面的开销会比较大。

@sFisherE
Copy link
Author

@sFisherE sFisherE commented Aug 13, 2020

用反射的基本对速度没有太高要求了,对速度敏感可以用生成wrap代码的那种方式了。
用到的时候再生成,并且加个cache的话,和之前的速度差别也不会太大。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.