Answers
Oracle的官方文档里已经说了,反射API会慢一些。如果确实是性能要求比较高的应用,最好不要用发射。
http://docs.oracle.com/javase/tutorial/reflect/index.html
Performance Overhead
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.
你是真皮虾发
answered 11 years, 6 months ago