What are some common methods for optimizing a Java program in terms of speed. I use DOM Parser to parse an XML file, and then save certain words in an ArrayList, delete any duplicates, and then check these words, creating a Google search URL for each word, getting an html document, find the corrected word and save it with another ArrayList .
Any help would be appreciated! Thank.
Why do you need to improve performance? From your explanation, it’s pretty obvious that the big bottleneck here (or performance) will be IO as a result of accessing the URL .
This, of course, will overshadow by an order of magnitude minor improvements in data structures or XML infrastructures.
A good general rule is that your big performance issues will be related to IO. Enough of humor, I'm at this very moment waiting for the database query to return in the batch process. He works for almost an hour. But I welcome any suggested improvements in my XML syntax library nonetheless!
Here are my general methods:
- (IO)? , , ( )?
(.. , , , - "" )? , Map, , .
Map
- (, ), ?
(, jvisualvm, JDK) . JVM ?
jvisualvm
SAX , DOM. ArrayList , LinkedHashMap - , , ArrayList.
HTTP- Google, , . .
: . , , .
, - , , . , 90% , .
, , . , ArrayList O (n²), , O (n), .
, , , , StackOverflow.
Edit
@oxbow_lakes, , , . , , , . " " , , . :
"ping Google", , . :
, , , , , . , TinyMCE javascript , -. , AJAX, , .
These people are probably right, but a few random pauses will turn * possibly "into" definitely, and that's why. "
Source: https://habr.com/ru/post/1775296/More articles:Parsec - Lots and Error Messages - haskellSql server 2008 connection string error - sql-server-2008Карта внутри Panorama перемещает панораму при панорамировании карты - windows-phone-7How to check only some elements on a web page and not on others? - validationOpen Source CMS Recommendation (Windows, .NET) - windowsCan JAX-WS display XSD date (xs: dateTime) in a Java calendar? - javaGetting all subgroups with regex - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1775299/setting-fullscreen-exclusive-mode-for-javafx-desktop-application&usg=ALkJrhhYmZXCSaZ3qWZD7WmQG7sumElLVAjava.lang.NoClassDefFoundError: javax / servlet / jsp / el / ELException - javajsp includes a page parameter using a HashMap in the request attribute - jspAll Articles