JEditorPane setText 2MB HTML ---> Awful performance !!! (65 seconds)

I'm trying to upload an HTML file about 2 MB in size (1927 KB for the sake of accuracy) to JEditorPane, and it takes about 65 seconds, it seems that this is a JTextPane / JEditorPane error, I have also read some articles on the Internet, like this one , but I don’t could find a solution ...

Here is the code I'm using:

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

The setText method takes about 65 seconds to complete, 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 any way to solve this problem?

About 65 seconds to download 2 MB of text - terrible performance on Intel Core 2 Duo 2.93 GHz with 8 GB of DDR 3 ...

+5
source share

All Articles