Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JEditorPane setText 2MB HTML ---> Terrible Performance !!! (65 seconds)

I'm trying to load an HTML file that is large approximately 2MB (1927KB for the sake of precision) into a JEditorPane, and it takes about 65 seconds, it seems to be a bug of the JTextPane/JEditorPane, i have read also several articles on the web like this one, but i couldn't find a solution ...

Here's the code that i use :

final String htmlContent = //Load a 2MB String
previewPane.setContentType("text/html; charset=UTF-8");     
previewPane.setText(htmlContent);

The setText method takes about 65seconds to get completely executed as you can see in my application log :

Set the html content(1927KB) of the Preview pane, loading time=68230ms
Set the html content(1927KB) of the Preview pane, loading time=62693ms
Set the html content(1927KB) of the Preview pane, loading time=66583ms

Is there a way to solve this problem ?

About 65 seconds to load 2MB of Text is a terrible performance on an Intel Core 2 Duo 2.93GHz with 8GB of DDR 3 RAM ...

like image 430
aleroot Avatar asked Oct 23 '22 11:10

aleroot


1 Answers

May be some of the tricks help http://java-sl.com/JEditorPanePerformance.html

like image 121
StanislavL Avatar answered Oct 27 '22 10:10

StanislavL