5

I am working on new free compression plugin

https://github.com/youjoomla/jcompress

https://github.com/youjoomla/jcompress/archive/master.zip

and need some help in speeding things up. The process of caching is fairly simple ,

  • Get everything in head tag
  • Separate the css files, js files, inline css and inline js
  • Parse all and minify
  • Replace the current head tag contents with new cached one. ( this is trouble )
  • Check log for file changes, if there is change , delete the cache for that page and recreate it.
  • Scan pages in admin back-end for fast cache creation

Everything works , the pages scan , the compression , css image paths replacement , js and css minify , gzip , I mean everything .

Trouble I have with and to me it seems like it is slowing the rendering down is replaceFiles method https://github.com/youjoomla/jcompress/blob/master/jcompress.php#L567

In order to get the head tag contents. I have to do all of this in

onAfterRender(){

}

All methods you see in the plugin except

replaceFiles()

https://github.com/youjoomla/jcompress/blob/master/jcompress.php#L567 and

checkLog()

https://github.com/youjoomla/jcompress/blob/master/jcompress.php#L758

are killed if the cache file exists.

Can anyone take a sec and see if there is something I could do to speed up the replacement of the head contents. And please take a min and test it on your server.

On my local the things are flying. On my live http://stefanstojanovic.com/jcompress/ I see a lag. No bugs , no errors, all cached files created and served. I hope is just my server but I am not sure.

Here are few more test sites http://stefanstojanovic.com/jcompress3/ http://stefanstojanovic.com/jcompress2/

I see a lag on first load , for example here http://stefanstojanovic.com/jcompress3/index.php/breadcrumbs

Next load is 150% faster It "kinda" does make sense since on second load cached css and js is coming from your cache but it should not be such a difference.

Any help is appreciated.

*Update: In meantime I managed to speed it up a bit by only getting the head tag contents instead of the whole body but I still see the lag.

One major difference I also see is between php 5.3 and 5.4 and up. But still no errors on each.

closed as unclear what you're asking by Valentin Despa Nov 30 '14 at 14:36

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    How is this not explaining the issue? prntscr.com/5bq5w3 The pages were slow loading even if the compressed files existed. And how is this a reason for down voting? – Dan Nov 30 '14 at 14:42
  • or this for that matter prntscr.com/5bq76u – Dan Nov 30 '14 at 14:45
3

Ahhhh! OK so the plugin does work perfect but I used an item id in the hook name for cached file so for 60 menu items you end-up with 60 cached css and js where there is no need for them.

Changing hook name to just count the bytes of exploded css or js files arrays and this way determine if there is difference , makes this plugin fly!

Not the answer you're looking for? Browse other questions tagged or ask your own question.