您的位置:首页 > 编程语言 > Java开发

Java反射为什么慢

2015-12-24 23:40 495 查看
Because reflection involves types that are dynamically resolved, certain Java virtual machine optimizations can not be performed. Consequently, reflective operations have slower performance than their non-reflective counterparts, and should be avoided in sections of code which are called frequently in performance-sensitive applications.

反射是动态的对类型、方法进行解析,肯定是会比直接调用慢一点。jvm无法优化

java反射机制,是在运行状态中,对于任何一个类,都能够访问这个类的所有属性和方法,同时任何一个对象也都能够调用它的任意一个方法和属性,这个功能称为java语言的反射机制
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  java reflect