I have a 10K static file with a word in each line. I need to create an array of String [] with all the words. I have 2 options:
Now, my question is that after all this, adding a word from array 1 (pay attention to the final keyword ) is noticeably faster than a word from array 2 (there is no final keyword, because we load words at run time). Does it theoretically matter? And we are talking here about Android, not about Java. But I am interested in both cases.
General Java:
There are no byte codes in the JVM to initialize the array, so the compiler finishes creating separate assignment statements for each element of the array that inflates the code. See here for more details .
, . , , .
Android:
DVM JVM, . , .
, , , . , , , .
, . , 2 String, ...
, , . , . ( 100%, Java , # , ).
, 10k. [] . , , final, Java JITTER, , [] .
Creating a final array does not make its elements final. This is one of the drawbacks of Java compared to C ++. The only practical effect would be with optimizers and obfuscators. With what you described, I am sure that there will be no noticeable difference.
Source: https://habr.com/ru/post/1789590/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1789585/css-ordering-convention-for-which-tags-to-specify-first&usg=ALkJrhhLAkHoXN6RMFTkskkxsvVZrUKj0wHow to wrap divs like this? - htmlhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1789587/repository-pattern-method-signature-for-editdelete-methods&usg=ALkJrhhdXi3hKilwdgYcNdzZaS-khtQXwQHow to implement a constant number counter on a site - javascript.NET Exception не обнаруживается при использовании функции RAISERROR в SQL Server - .netcomparing QTest with other structures - c ++Help understanding applications with multiple Cocoa controllers - objective-cSpring Безопасность 3.x: создание собственного поставщика проверки подлинности без UserDetailsService - javaIf you ever get weird syntax errors in R.java file, check this problem - androidThe basics of NDK and OpenGL for Android - androidAll Articles