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

hprose.io.unserialize.Reader.unserialize占用CPU奇高 #44

Closed
gwenson opened this issue May 18, 2018 · 2 comments
Closed

hprose.io.unserialize.Reader.unserialize占用CPU奇高 #44

gwenson opened this issue May 18, 2018 · 2 comments

Comments

@gwenson
Copy link

gwenson commented May 18, 2018

我是这样使用的:

HproseFormatter.unserialize(value,List.class);

是不是我使用方法不对?
learning

@andot
Copy link
Member

andot commented May 18, 2018

PropertyAccessor.unserialize 是通过反射调用属性上 setter 方法来设置属性的。反射操作比其他操作占用更多的 CPU 时间是正常的,反射调用本来就比普通调用要慢几十到几百倍。

这部分虽然可以通过生成字节码的方式来优化,但是这需要依赖第三方的包,而且不支持 Android,所以目前这部分没有使用生成字节码的方式优化。

@gwenson
Copy link
Author

gwenson commented May 19, 2018

噢,谢谢。

@gwenson gwenson closed this as completed May 19, 2018
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

No branches or pull requests

2 participants