cssin icon indicating copy to clipboard operation
cssin copied to clipboard

CSSIN-inlineCSS() call takes 8 sec on my Core I 5 server

Open ildar-aim opened this issue 10 years ago • 7 comments

cssin

As you can see

InlineCSS() takes 73%(8 sec) of all my script InlineCSS() calls 1)parseCSS(41.99 %) 2)simple_dom_data->find(25 %) (may be http://ru2.php.net/manual/en/book.dom.php can be used ?)

parseCSS() calls csstidy->parse(38.67%)

csstidy->is_token is called 33084 times !

ildar-aim avatar Mar 21 '14 06:03 ildar-aim

cssin2 cssin3 cssin4

ildar-aim avatar Mar 21 '14 06:03 ildar-aim

For example smarty engine takes only 1.63 % of all the script's time

ildar-aim avatar Mar 21 '14 06:03 ildar-aim

207 SQL queries take 3.61 % SMTP phpmailer takes 8.47%

ildar-aim avatar Mar 21 '14 06:03 ildar-aim

[~/tmp/cssin/src]$ time php test.php php test.php 0,35s user 4,96s system 59% cpu 8,922 total

This call takes 8,922 sec

<?php

require_once 'CSSIN.php';

$cssin = new FM\CSSIN();

$html_with_inlined_css = $cssin->inlineCSS('http://demo.x-cart.com/demo/order.php?mode=invoice&orderid=1003&access_key=fb760e6fd95aaafe');
?>

ildar-aim avatar Mar 21 '14 07:03 ildar-aim

If you know a viable alternative to csstidy I'll take it, but it's the most reliable I've found...

djfm avatar Jun 23 '14 04:06 djfm

To solve this problem you need to cache parsed file and reuse it.

FDiskas avatar Mar 30 '15 10:03 FDiskas

If you know a viable alternative to csstidy I'll take it, but it's the most reliable I've found...

Maybe it will work faster https://github.com/Cerdic/CSSTidy

ildar-aim avatar Dec 13 '18 06:12 ildar-aim