pete stein wrote:1) Are you using a SwingWorker object so that the stream reading and HTML parsing are done in a background thread, and the Swing rendering done on the EDT?
pete stein wrote:
2) How do you know that it's the Swing rendering that takes 134 seconds? Have you run this through a profiler?
Yahya Elyasse wrote: i parse this html response and convert it to swing components. it is mapping html input fields to swing components.
Maneesh Godbole wrote:
When are you creating the Swing components? After parsing the HTML? Is it possible for you to create them first and then use from the cache?
Maneesh Godbole wrote:
Disclaimer: I have never tried this out myself. Please take it with a pinch of salt. I am just thinking out loud here.
Also google for XML-Swing frameworks. I read about one such framework recently, but cannot recall the name right now. Since its an existing framework, chances are they have already taken care of the optimization.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Prime wrote:No offence, but I think there must be a flaw in your program. 47 seconds to parse an HTML file? How large is that file, a few hundred megabytes? And over 2 minutes for generating and rendering components? My most heavy GUI ever created takes only a few seconds (5-10 max) to create the GUI, and that is one heavy GUI.
Can you show us your rendering and genering code?
Ulf Dittmer wrote:Umm ... 750 lines of code? I don't think too many people here will be willing to go through that (not without taking a cut of the money you make for working on this anyway
)
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Prime wrote:You should consider caching at least the SimpleDocument; tidying and parsing is probably the most expensive task, and you're calling it at least twice - once in getFormMessage() and once in getTitle().
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Ulf Dittmer wrote:How is HTML parsing done now - are you using a library? I might convert it to XML (using something like Neko or TagSoup), and then run a SAX parser over it, or use a library like HtmlUnit.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |