Possible duplicate:Why is reflection slow?
Some parts of the reflection are said to not work very well. Is this true and what parts of it are considered slow?
Reference Information. I am currently experimenting with a self-adjusting resistance level using reflection. I havenβt done anything yet. I just need to know where the possible optimization points are located so that I can develop the program well.
Most frameworks that use reflection reflect the results of reflective operations, so they donβt need to repeat them. So in fact, everything happens once at startup.
- "". API . - . 1- .
. Class.getMethod(), Class.getField(), Class.getDeclaredMethod() .. Class.forName() ( , ).
Class.getMethod()
Class.getField()
Class.getDeclaredMethod()
Class.forName()
, , .
Method m = Class.getMethod("foo"); // do it once // now invoke it as many times as you want m.invoke(obj);
- , , . , , .
, , . , - .
" ", . . . . Java generics , . . , "" , " ", , .
, . - , , . , , ; , . :
mv "1bill and fred(kfjw0f3).jpg" "1 - bill and fred.jpg" mv "2sam and kim(g02fsgsg).jpg" "2 - sam and kim.jpg" . . .
Ruby, mv, .
. . .
, , - ,... . ... .
PS: ,
http://buzdin.blogspot.com/2011/01/is-java-reflection-really-slow.html
,
( , ).
, JIT, . , , , , , ..
, . , , , . .
:
: , , , .
: , , .
, ""!!!!!!!! - , - !!!!!
: ! , , - ~ 20%, ~ 80% , . , java , , , . , , .: D
Source: https://habr.com/ru/post/1786792/More articles:Java - multiple requests from two WebContainer threads - javaInsert data into mysql table data from FIFO channel in linux continuously - linuxHow is a real-time billboard made at Apple? - javascriptCreate a collection with different data types and bind to a list - c #Is the Content-Type header suitable for any HTTP verb other than PUT or POST? - content-typeError trying to start Scala Application inside Eclipse - eclipseEncrypt SQLite Database File on iOS - iosMapfile as an input to MapReduce - javaSQL style question: INNER JOIN in FROM or WHERE clause? - sqlValidates_each to allow only specific emails? - ruby-on-railsAll Articles