Oops, I just realized you meant in my patch. Sorry, yes, that would help. - Amir
On Tue, Sep 15, 2009 at 8:05 PM, Miroslav Pokorny < miroslav.poko...@gmail.com> wrote: > A mini improvement -what about moving the Pattern.compile into a static so > it's only created once. > > On 16/09/2009, at 10:11 AM, Amir Kashani <amirkash...@gmail.com> wrote: > > Fairly recently, we converted our app to make extensive use of CssResource > and StyleInjector. When we did this, we noticed a *huge* performance > bottleneck while generating the stylesheets, causing development mode to > take about a minute to start. Using a (Java) profiler, I noticed about 90% > of the startup time being spent in a Matcher.find call used in > ClassRenamer.endVisit. The endVisit method is called once for every rule in > a target CSS file. Matcher.find is in turn called for each method in the > target CssResouce + all imported CssResources. In one case, this resulted > in 15,000+ calls to Matcher.find. > Attached is a patch that simplifies the logic and speeds up the renaming > process quite a bit. I haven't run any test cases against it, but I did > compare the output of my patch with the original code and they appear to be > identical. As far as numbers go, I don't have hard numbers, but in our app, > development mode startup went from about a minute to around 15 seconds. > > Also, I should mention that the original code had a TODO to simply the > logic by creating a class hierarchy for selectors. In that larger context, > this patch may not be necessary. In the meantime, however, this speeds up > generation for non-trivial CSS files quite dramatically > > - Amir > > > <ClassRenamer trunk6111.patch> > > > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---