changcheng / wro4j

Automatically exported from code.google.com/p/wro4j
0 stars 0 forks source link

Very slow lessCss #481

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm running wro4j 1.4.7 runtime solution with WroFilter.

LessCss processes 25 KB (compiled css) file for 5 minutes. Is it normal?

DEBUG ro.isdc.wro.extensions.processor.support.less.LessCss  - StopWatch '': 
running time (millis) = 294211

Maven plugin processes all my files for 1 or 2 minutes.

Original issue reported on code.google.com by xmedve...@gmail.com on 6 Jul 2012 at 11:50

GoogleCodeExporter commented 9 years ago
The Rhino based processors are known to be slow. Depending on the number of 
processed resources, it can vary from 5 seconds to several minutes. There 
should be no difference between using runtime vs buildtime solution. Are you 
sure the same resources are processed in both cases? Can you provide more 
details about the number of resources do you have and how your configuration 
looks like?

Original comment by alex.obj...@gmail.com on 6 Jul 2012 at 11:53

GoogleCodeExporter commented 9 years ago
One more question. Does all of your css code require lessCss processing? If 
not, you can apply the processor only on certain resources (for example: those 
having *.less extension), thus improving the overall processing time.

Original comment by alex.obj...@gmail.com on 6 Jul 2012 at 11:55

GoogleCodeExporter commented 9 years ago
That's my config:
debug=false
managerFactoryClassName=ro.isdc.wro.manager.factory.ConfigurableWroManagerFactor
y
preProcessors=
postProcessors=lessCss
modelUpdatePeriod=3600
cacheUpdatePeriod=360
#disableCache=true
parallelPreprocessing=true
gzipResources=false

web.xml:
    <filter>
        <filter-name>WebResourceOptimizer</filter-name>
        <filter-class>ro.isdc.wro.http.WroFilter</filter-class>
    </filter>

I have two groups on a page: global and page group. Global include 3 files and 
wildcard for folder with 41 files. Page group includes 1-3 files. 5-6 minutes 
if processing time form small group (page) and the global one is processed in 
9-10 minutes.

On the other hand, when I was on 1.4.5 and 
ExtensionsConfigurableWroManagerFactory lessCss rpocessor was mach faster.

Maven config:

            <plugin>
                <groupId>ro.isdc.wro4j</groupId>
                <artifactId>wro4j-maven-plugin</artifactId>
                <version>${wro4j.version}</version>
                <configuration>
                <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
                    <destinationFolder>${wro4j.outputFolder}</destinationFolder>
                    <contextFolder>${basedir}/src/main/webapp/</contextFolder>
                    <minimize>true</minimize>
                </configuration>
            </plugin>

Maven processes global and 6-7 page groups in 1-3 minutes.

Original comment by xmedve...@gmail.com on 6 Jul 2012 at 12:05

GoogleCodeExporter commented 9 years ago
Is there any reason why you use LessCss as a post processor?
Processing small chunks of css is faster than one very large.

Original comment by alex.obj...@gmail.com on 6 Jul 2012 at 12:07

GoogleCodeExporter commented 9 years ago
You are saying that with 1.4.5 lessCss was much faster. Very interesting. 
I would like to be able to reproduce it. Could you share your resources or 
anything which proves your statement?

Original comment by alex.obj...@gmail.com on 6 Jul 2012 at 12:08

GoogleCodeExporter commented 9 years ago
>Is there any reason why you use LessCss as a post processor?
>Processing small chunks of css is faster than one very large.

I have all-project less mixins, so I have to group all files in one, so less 
could process this mixins in files

>You are saying that with 1.4.5 lessCss was much faster. Very interesting. 

A lot of time and code passed from 1.4.5. I'll try to process my project with 
1.4.5 now and compare execution time on same code.

Original comment by xmedve...@gmail.com on 6 Jul 2012 at 12:19

GoogleCodeExporter commented 9 years ago
I would gladly switch lessCssProcessor from Rhino to v8 javascript engine or a 
java library which transform less code into css. The v8 js engine integration 
with java is not available (or not easy yet), while the java librar for 
transforming less into css is under development and not ready yet. 

Original comment by alex.obj...@gmail.com on 6 Jul 2012 at 12:24

GoogleCodeExporter commented 9 years ago
I know that. I've google for native java lessCss library for two last days. The 
interesting project I found is ZUSS. Language similar to LESS and SASS, but on 
Java.

Original comment by xmedve...@gmail.com on 6 Jul 2012 at 12:37

GoogleCodeExporter commented 9 years ago
The problem resolved. And it was not in wro4j. We have a lot of scheduled tasks 
running after restart and java ate  all the processor. So Rhino was too slow 
because of processor lack. Issue is closed.

Thank you for wro4j and excuse me for bothering.

Original comment by xmedve...@gmail.com on 6 Jul 2012 at 12:41

GoogleCodeExporter commented 9 years ago
No problem. Glad issue solved.

Original comment by alex.obj...@gmail.com on 6 Jul 2012 at 1:06