| Filename | /home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/Webmerge/Compile/CSS.pm |
| Statements | Executed 262832 statements in 31.3s |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 172152 | 21 | 1 | 23.3s | 23.3s | RTP::Webmerge::Compile::CSS::CORE:subst (opcode) |
| 8 | 1 | 1 | 5.67s | 31.3s | RTP::Webmerge::Compile::CSS::compileCSS |
| 82696 | 7 | 1 | 1.83s | 1.83s | RTP::Webmerge::Compile::CSS::CORE:substcont (opcode) |
| 61904 | 3 | 1 | 160ms | 160ms | RTP::Webmerge::Compile::CSS::CORE:match (opcode) |
| 4560 | 1 | 1 | 150ms | 167ms | RTP::Webmerge::Compile::CSS::__ANON__[:109] |
| 28681 | 3 | 1 | 146ms | 146ms | RTP::Webmerge::Compile::CSS::CORE:regcomp (opcode) |
| 1 | 1 | 1 | 91µs | 130µs | RTP::Webmerge::Compile::CSS::BEGIN@15 |
| 1 | 1 | 1 | 89µs | 358µs | RTP::Webmerge::Compile::CSS::BEGIN@13 |
| 1 | 1 | 1 | 66µs | 576µs | RTP::Webmerge::Compile::CSS::BEGIN@41 |
| 1 | 1 | 1 | 57µs | 57µs | RTP::Webmerge::Compile::CSS::BEGIN@25.28 |
| 1 | 1 | 1 | 54µs | 143µs | RTP::Webmerge::Compile::CSS::BEGIN@14 |
| 2 | 2 | 1 | 42µs | 42µs | RTP::Webmerge::Compile::CSS::CORE:qr (opcode) |
| 1 | 1 | 1 | 28µs | 28µs | RTP::Webmerge::Compile::CSS::BEGIN@28 |
| 1 | 1 | 1 | 27µs | 27µs | RTP::Webmerge::Compile::CSS::BEGIN@22 |
| 1 | 1 | 1 | 22µs | 22µs | RTP::Webmerge::Compile::CSS::BEGIN@25 |
| 0 | 0 | 0 | 0s | 0s | RTP::Webmerge::Compile::CSS::__ANON__[:163] |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | ################################################################################################### | ||||
| 2 | # Copyright 2013 by Marcel Greter | ||||
| 3 | # This file is part of Webmerge (GPL3) | ||||
| 4 | ################################################################################################### | ||||
| 5 | # more ideas: | ||||
| 6 | # - make selectors uppercase for gzip | ||||
| 7 | # - make all declarations lowercase for gzip | ||||
| 8 | # - add more logic to optimize one selector (like paddings) | ||||
| 9 | ################################################################################################### | ||||
| 10 | package RTP::Webmerge::Compile::CSS; | ||||
| 11 | ################################################################################################### | ||||
| 12 | |||||
| 13 | 2 | 186µs | 2 | 627µs | # spent 358µs (89+269) within RTP::Webmerge::Compile::CSS::BEGIN@13 which was called:
# once (89µs+269µs) by main::BEGIN@41 at line 13 # spent 358µs making 1 call to RTP::Webmerge::Compile::CSS::BEGIN@13
# spent 269µs making 1 call to Exporter::import |
| 14 | 2 | 142µs | 2 | 232µs | # spent 143µs (54+89) within RTP::Webmerge::Compile::CSS::BEGIN@14 which was called:
# once (54µs+89µs) by main::BEGIN@41 at line 14 # spent 143µs making 1 call to RTP::Webmerge::Compile::CSS::BEGIN@14
# spent 89µs making 1 call to strict::import |
| 15 | 2 | 239µs | 2 | 168µs | # spent 130µs (91+39) within RTP::Webmerge::Compile::CSS::BEGIN@15 which was called:
# once (91µs+39µs) by main::BEGIN@41 at line 15 # spent 130µs making 1 call to RTP::Webmerge::Compile::CSS::BEGIN@15
# spent 39µs making 1 call to warnings::import |
| 16 | |||||
| 17 | ################################################################################################### | ||||
| 18 | # ToDo: Merge with spriteset css parser and create a common parser module | ||||
| 19 | ################################################################################################### | ||||
| 20 | |||||
| 21 | # define our version string | ||||
| 22 | 1 | 154µs | 1 | 27µs | # spent 27µs within RTP::Webmerge::Compile::CSS::BEGIN@22 which was called:
# once (27µs+0s) by main::BEGIN@41 at line 22 # spent 27µs making 1 call to RTP::Webmerge::Compile::CSS::BEGIN@22 |
| 23 | |||||
| 24 | # load exporter and inherit from it | ||||
| 25 | 3 | 410µs | 2 | 79µs | BEGIN { use Exporter qw(); our @ISA = qw(Exporter) } # spent 57µs making 1 call to RTP::Webmerge::Compile::CSS::BEGIN@25.28
# spent 22µs making 1 call to RTP::Webmerge::Compile::CSS::BEGIN@25 |
| 26 | |||||
| 27 | # define our functions to be exported | ||||
| 28 | 1 | 342µs | 1 | 28µs | # spent 28µs within RTP::Webmerge::Compile::CSS::BEGIN@28 which was called:
# once (28µs+0s) by main::BEGIN@41 at line 28 # spent 28µs making 1 call to RTP::Webmerge::Compile::CSS::BEGIN@28 |
| 29 | |||||
| 30 | ################################################################################################### | ||||
| 31 | # setup regular expression to match various css stuff | ||||
| 32 | ################################################################################################### | ||||
| 33 | |||||
| 34 | # regular expression to find color doublets (like #CC3399) | ||||
| 35 | 1 | 78µs | 1 | 33µs | my $re_color_doublet = qr/(?:00|11|22|33|44|55|66|77|88|99|AA|BB|CC|DD|EE|FF)/i; # spent 33µs making 1 call to RTP::Webmerge::Compile::CSS::CORE:qr |
| 36 | 1 | 155µs | 2 | 110µs | my $re_colors_doublet = qr/\#($re_color_doublet)($re_color_doublet)($re_color_doublet)/i; # spent 100µs making 1 call to RTP::Webmerge::Compile::CSS::CORE:regcomp
# spent 10µs making 1 call to RTP::Webmerge::Compile::CSS::CORE:qr |
| 37 | |||||
| 38 | ################################################################################################### | ||||
| 39 | |||||
| 40 | # load regular expression from spriteset parser | ||||
| 41 | 2 | 5.37ms | 2 | 1.09ms | # spent 576µs (66+510) within RTP::Webmerge::Compile::CSS::BEGIN@41 which was called:
# once (66µs+510µs) by main::BEGIN@41 at line 41 # spent 576µs making 1 call to RTP::Webmerge::Compile::CSS::BEGIN@41
# spent 510µs making 1 call to Exporter::import |
| 42 | |||||
| 43 | ################################################################################################### | ||||
| 44 | |||||
| 45 | # do the main css compilation | ||||
| 46 | # this method may be usefull for others | ||||
| 47 | # this module should be able to run standalone | ||||
| 48 | sub compileCSS | ||||
| 49 | # spent 31.3s (5.67+25.6) within RTP::Webmerge::Compile::CSS::compileCSS which was called 8 times, avg 3.91s/call:
# 8 times (5.67s+25.6s) by RTP::Webmerge::Merge::CSS::__ANON__[/home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/Webmerge/Merge/CSS.pm:80] at line 79 of webmerge/scripts/modules/RTP/Webmerge/Merge/CSS.pm, avg 3.91s/call | ||||
| 50 | |||||
| 51 | # get input variables | ||||
| 52 | 8 | 2.57ms | my ($content, $config) = @_; | ||
| 53 | |||||
| 54 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||||
| 55 | |||||
| 56 | # replace multi-newlines | ||||
| 57 | 8 | 1.21s | 8 | 1.21s | $content =~ s/(?:\n|\r|\n\r|\r\n)+/\n/g; # spent 1.21s making 8 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 152ms/call |
| 58 | |||||
| 59 | # trim leading whitespace | ||||
| 60 | 8 | 78.6ms | 8 | 78.2ms | $content =~ s/^\s+//gm; # spent 78.2ms making 8 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 9.78ms/call |
| 61 | |||||
| 62 | # trim multiline comments | ||||
| 63 | 8 | 64.5ms | 8 | 64.1ms | $content =~ s/\/\*(.|\n)+?\*\///gi; # spent 64.1ms making 8 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 8.01ms/call |
| 64 | |||||
| 65 | # replace multi-newline again | ||||
| 66 | 8 | 750ms | 8 | 750ms | $content =~ s/(?:\n|\r)+/\n/g; # spent 750ms making 8 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 93.7ms/call |
| 67 | |||||
| 68 | # trim leading whitespace | ||||
| 69 | 8 | 27.8ms | 8 | 27.6ms | $content =~ s/^\s+//gm; # spent 27.6ms making 8 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 3.45ms/call |
| 70 | |||||
| 71 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||||
| 72 | # optimize all properties first | ||||
| 73 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||||
| 74 | |||||
| 75 | # split content into properties | ||||
| 76 | # this is only an approximation but should | ||||
| 77 | # solve most of the 'strange' ie behaviours | ||||
| 78 | 8 | 32.3ms | my @properties = split (/;/, $content); | ||
| 79 | |||||
| 80 | # process each property | ||||
| 81 | 8 | 127µs | foreach (@properties) | ||
| 82 | { | ||||
| 83 | |||||
| 84 | # do not optimize ie filters | ||||
| 85 | 28672 | 513ms | 28672 | 81.9ms | next if m/filter\s*:/; # spent 81.9ms making 28672 calls to RTP::Webmerge::Compile::CSS::CORE:match, avg 3µs/call |
| 86 | # do not optimize ie expressions | ||||
| 87 | 28672 | 388ms | 28672 | 61.5ms | next if m/:\s*expression\(\s*/; # spent 61.5ms making 28672 calls to RTP::Webmerge::Compile::CSS::CORE:match, avg 2µs/call |
| 88 | |||||
| 89 | # compress superfluous units | ||||
| 90 | # example: 0px/0em/0pt/0% to 0 | ||||
| 91 | 28672 | 428ms | 28672 | 61.4ms | s/\b0(?:px|\%|em|pt)(?=\s|\b|\Z|;|,)/0/gm; # spent 61.4ms making 28672 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 2µs/call |
| 92 | |||||
| 93 | # compress colors triplets | ||||
| 94 | # example: #CC3399 -> #C39 | ||||
| 95 | 28672 | 1.16s | 58976 | 237ms | s/$re_colors_doublet/'#'.substr($1,1).substr($2,1).substr($3,1)/gemi; # spent 144ms making 28672 calls to RTP::Webmerge::Compile::CSS::CORE:regcomp, avg 5µs/call
# spent 83.0ms making 28672 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 3µs/call
# spent 9.90ms making 1632 calls to RTP::Webmerge::Compile::CSS::CORE:substcont, avg 6µs/call |
| 96 | |||||
| 97 | # normalize colors to lowercase (good for gzip compression) | ||||
| 98 | # ToDo: replace color names with their rgb counterparts | ||||
| 99 | 28672 | 355ms | 28672 | 59.3ms | s/\#([0-9A-Fa-f]{6})(?=\s|\Z|;|,)/'#' . lc($1)/egm; # spent 59.3ms making 28672 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 2µs/call |
| 100 | 28672 | 514ms | 30304 | 67.1ms | s/\#([0-9A-Fa-f]{3})(?=\s|\Z|;|,)/'#' . lc($1)/egm; # spent 61.2ms making 28672 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 2µs/call
# spent 5.93ms making 1632 calls to RTP::Webmerge::Compile::CSS::CORE:substcont, avg 4µs/call |
| 101 | |||||
| 102 | # unwrap quoted strings whenever possible (like for urls, fonts) | ||||
| 103 | # there is a bug in IE where format has to be enclosed in quotes | ||||
| 104 | # we implemented a bugfix below that will re-add quotes in that case | ||||
| 105 | my $unwrap = sub | ||||
| 106 | # spent 167ms (150+17.0) within RTP::Webmerge::Compile::CSS::__ANON__[/home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/Webmerge/Compile/CSS.pm:109] which was called 4560 times, avg 37µs/call:
# 4560 times (150ms+17.0ms) by RTP::Webmerge::Compile::CSS::compileCSS at line 114, avg 37µs/call | ||||
| 107 | 4560 | 251ms | 4560 | 17.0ms | ($_[1] =~ m/\s/mg || $_[1] eq "") # spent 17.0ms making 4560 calls to RTP::Webmerge::Compile::CSS::CORE:match, avg 4µs/call |
| 108 | ? $_[0].$_[1].$_[0] : $_[1] | ||||
| 109 | 28672 | 310ms | }; | ||
| 110 | |||||
| 111 | # call the created unwrapper method | ||||
| 112 | # for both: single and double quotes | ||||
| 113 | 28672 | 511ms | 28672 | 69.5ms | s/\"([^\"]*)\"/$unwrap->('"', "$1")/egx; # spent 69.5ms making 28672 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 2µs/call |
| 114 | 28672 | 1.11s | 42352 | 370ms | s/\'([^\']*)\'/$unwrap->("'", "$1")/egx; # spent 167ms making 4560 calls to RTP::Webmerge::Compile::CSS::__ANON__[webmerge/scripts/modules/RTP/Webmerge/Compile/CSS.pm:109], avg 37µs/call
# spent 138ms making 28672 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 5µs/call
# spent 64.0ms making 9120 calls to RTP::Webmerge::Compile::CSS::CORE:substcont, avg 7µs/call |
| 115 | |||||
| 116 | } | ||||
| 117 | # EO each property | ||||
| 118 | |||||
| 119 | # join the content back together | ||||
| 120 | 8 | 9.25ms | $content = join(';', @properties); | ||
| 121 | |||||
| 122 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||||
| 123 | # optimize with more general rules over while text | ||||
| 124 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||||
| 125 | |||||
| 126 | # remove leading zero for float numbers (ie 0.5 => .5) | ||||
| 127 | 8 | 3.69ms | 8 | 3.42ms | $content =~ s/\b0+(\.[0-9]+(?:px|\%|em|pt|s)?)(?=\s|\b|\Z|;|,)/$1/gm; # spent 3.42ms making 8 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 427µs/call |
| 128 | |||||
| 129 | # shorten redundant margin/padding definitions | ||||
| 130 | # are there any four value shorthands that cannot | ||||
| 131 | # be optimized in this way? I don't know any so far! | ||||
| 132 | # unsure if we could do it for three value shorthands? | ||||
| 133 | # ie -> margin: 5px 5px 5px 5px; => margin: 5px; | ||||
| 134 | # ie -> margin: 5px 8px 5px 8px; => margin: 5px 8px; | ||||
| 135 | # ie -> margin: 5px 8px 0px 8px; => margin: 5px 8px 0px; | ||||
| 136 | 8 | 90.4ms | 28 | 89.8ms | $content =~ s/ # spent 79.7ms making 8 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 9.97ms/call
# spent 10.0ms making 20 calls to RTP::Webmerge::Compile::CSS::CORE:substcont, avg 502µs/call |
| 137 | 16 | 291µs | :\s* | ||
| 138 | \b([0-9]+(?:px|\%|em|pt|s)?)(?=\s|\b|\Z|;|,)\s* | ||||
| 139 | \b([0-9]+(?:px|\%|em|pt|s)?)(?=\s|\b|\Z|;|,)\s* | ||||
| 140 | 16 | 144µs | \b([0-9]+(?:px|\%|em|pt|s)?)(?=\s|\b|\Z|;|,)\s* | ||
| 141 | \b([0-9]+(?:px|\%|em|pt|s)?)(?=\s|\b|\Z|;|,)\s* | ||||
| 142 | \; | ||||
| 143 | / | ||||
| 144 | if ($1 eq $2 && $2 eq $3 && $3 eq $4) { ":$1;"; } | ||||
| 145 | elsif ($2 eq $4 && $1 eq $3) { ":$1 $2;" } | ||||
| 146 | elsif ($2 eq $4) { ":$1 $2 $3;" } | ||||
| 147 | else { ":$1 $2 $3 $4;"; } | ||||
| 148 | /egmx; | ||||
| 149 | |||||
| 150 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||||
| 151 | # optimize for css selectors and blocks | ||||
| 152 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||||
| 153 | |||||
| 154 | # remove selectors with no css style definitions (empty blocks) | ||||
| 155 | 8 | 20.5s | 16 | 20.5s | $content =~ s/$re_css_selector_rules\s*\{(?:\s*|\s*\/\*.*?\*\/\s*)}//gm; # spent 20.5s making 8 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 2.56s/call
# spent 1.70ms making 8 calls to RTP::Webmerge::Compile::CSS::CORE:regcomp, avg 212µs/call |
| 156 | |||||
| 157 | # only do this for insane optimization levels | ||||
| 158 | 8 | 77µs | if ($config->{'level'} > 4) | ||
| 159 | { | ||||
| 160 | |||||
| 161 | # normalize / sort selectors so we can match them correctly | ||||
| 162 | # this cannot have any impact, as they all reference the same block | ||||
| 163 | my $sel_sort = sub { return join(',', sort split(/\s*,\s*/, $_[0])); }; | ||||
| 164 | $content =~ s/($re_css_selector_rules)(\s*\{)/$sel_sort->($1) . "\n" . $2/egmx; | ||||
| 165 | |||||
| 166 | # get all used css selectors within this css context | ||||
| 167 | my %selectors; $selectors{$1} = 1 while($content =~ m/($re_css_selector_rules)\s*{/g); | ||||
| 168 | |||||
| 169 | # try to merge same selectors that fallow each other | ||||
| 170 | # this is very expensive, so only do it if requested | ||||
| 171 | foreach my $selector (keys %selectors) | ||||
| 172 | { | ||||
| 173 | 1 while | ||||
| 174 | ( | ||||
| 175 | $content =~ | ||||
| 176 | s/ | ||||
| 177 | (?:(?<=})|\A)\s* | ||||
| 178 | \Q$selector\E\s*{([^\}]+)} | ||||
| 179 | \s* | ||||
| 180 | \Q$selector\E\s*{([^\}]+)} | ||||
| 181 | / | ||||
| 182 | $selector . '{' . $1 . ';' . $2 . '}' | ||||
| 183 | /egx | ||||
| 184 | ); | ||||
| 185 | } | ||||
| 186 | # EO each selector | ||||
| 187 | |||||
| 188 | } | ||||
| 189 | # EO if opt level > 4 | ||||
| 190 | |||||
| 191 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||||
| 192 | |||||
| 193 | # use spriteset css parser to implement more advanced optimizations | ||||
| 194 | # - merge longhand padding/margin if all four axes are defined | ||||
| 195 | # - remove duplicate/superfluous style definitions (longhands) | ||||
| 196 | # - merge complete shorthands into a single longhand definition | ||||
| 197 | |||||
| 198 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||||
| 199 | |||||
| 200 | # fix for font face format (must be wrapped within quotes) | ||||
| 201 | # this might not be in the correct module but can avoid a bug | ||||
| 202 | 8 | 2.33ms | 8 | 2.16ms | $content =~ s/format\s*\(\s*([^\)]+)\s*\)/format("$1")/gx; # spent 2.16ms making 8 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 269µs/call |
| 203 | |||||
| 204 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||||
| 205 | |||||
| 206 | # remove unnecessary whitespace | ||||
| 207 | 8 | 1.79s | 65088 | 803ms | $content =~ s/\s*([\,\:\;\{\}\!])\s*/$1/gm; # spent 802ms making 65080 calls to RTP::Webmerge::Compile::CSS::CORE:substcont, avg 12µs/call
# spent 1.60ms making 8 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 200µs/call |
| 208 | |||||
| 209 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||||
| 210 | |||||
| 211 | # remove multiple semicolons | ||||
| 212 | 8 | 53.1ms | 8 | 52.7ms | $content =~ s/;+/\;/gm; # spent 52.7ms making 8 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 6.59ms/call |
| 213 | |||||
| 214 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||||
| 215 | |||||
| 216 | # shorten multi whitespace | ||||
| 217 | 8 | 27.5ms | 8 | 27.2ms | $content =~ s/\s+/ /gm; # spent 27.2ms making 8 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 3.40ms/call |
| 218 | |||||
| 219 | # remove traling whitespace | ||||
| 220 | 8 | 19.7ms | 8 | 19.5ms | $content =~ s/\s+\Z//gm; # spent 19.5ms making 8 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 2.43ms/call |
| 221 | |||||
| 222 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||||
| 223 | |||||
| 224 | # Experimental: remove unneeded chars | ||||
| 225 | 8 | 1.02s | 5020 | 940ms | $content =~ s/(?:;|\s)+([\{\}])/$1/gm; # spent 938ms making 5012 calls to RTP::Webmerge::Compile::CSS::CORE:substcont, avg 187µs/call
# spent 1.98ms making 8 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 247µs/call |
| 226 | 8 | 28.7ms | 208 | 26.4ms | $content =~ s/([\{\}])(?:;|\s)+/$1/gm; # spent 22.4ms making 8 calls to RTP::Webmerge::Compile::CSS::CORE:subst, avg 2.80ms/call
# spent 3.94ms making 200 calls to RTP::Webmerge::Compile::CSS::CORE:substcont, avg 20µs/call |
| 227 | |||||
| 228 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||||
| 229 | |||||
| 230 | # pretty print the packed css styles | ||||
| 231 | 8 | 76µs | if ($config->{'pretty'}) | ||
| 232 | { | ||||
| 233 | $content =~ s/([{}])/\n$1\n/gm; | ||||
| 234 | $content =~ s/\n+/\n/gm; | ||||
| 235 | } | ||||
| 236 | |||||
| 237 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||||
| 238 | # _clean(\$content) or die 'could not clean data'; | ||||
| 239 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||||
| 240 | |||||
| 241 | # return compiled | ||||
| 242 | 8 | 11.4ms | return $content; | ||
| 243 | |||||
| 244 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||||
| 245 | |||||
| 246 | } | ||||
| 247 | # EO sub compileCSS | ||||
| 248 | |||||
| 249 | ################################################################################################### | ||||
| 250 | ################################################################################################### | ||||
| 251 | 1 | 28µs | 1; | ||
# spent 160ms within RTP::Webmerge::Compile::CSS::CORE:match which was called 61904 times, avg 3µs/call:
# 28672 times (81.9ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 85, avg 3µs/call
# 28672 times (61.5ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 87, avg 2µs/call
# 4560 times (17.0ms+0s) by RTP::Webmerge::Compile::CSS::__ANON__[/home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/Webmerge/Compile/CSS.pm:109] at line 107, avg 4µs/call | |||||
sub RTP::Webmerge::Compile::CSS::CORE:qr; # opcode | |||||
# spent 146ms within RTP::Webmerge::Compile::CSS::CORE:regcomp which was called 28681 times, avg 5µs/call:
# 28672 times (144ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 95, avg 5µs/call
# 8 times (1.70ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 155, avg 212µs/call
# once (100µs+0s) by main::BEGIN@41 at line 36 | |||||
# spent 23.3s within RTP::Webmerge::Compile::CSS::CORE:subst which was called 172152 times, avg 136µs/call:
# 28672 times (138ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 114, avg 5µs/call
# 28672 times (83.0ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 95, avg 3µs/call
# 28672 times (69.5ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 113, avg 2µs/call
# 28672 times (61.4ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 91, avg 2µs/call
# 28672 times (61.2ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 100, avg 2µs/call
# 28672 times (59.3ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 99, avg 2µs/call
# 8 times (20.5s+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 155, avg 2.56s/call
# 8 times (1.21s+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 57, avg 152ms/call
# 8 times (750ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 66, avg 93.7ms/call
# 8 times (79.7ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 136, avg 9.97ms/call
# 8 times (78.2ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 60, avg 9.78ms/call
# 8 times (64.1ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 63, avg 8.01ms/call
# 8 times (52.7ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 212, avg 6.59ms/call
# 8 times (27.6ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 69, avg 3.45ms/call
# 8 times (27.2ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 217, avg 3.40ms/call
# 8 times (22.4ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 226, avg 2.80ms/call
# 8 times (19.5ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 220, avg 2.43ms/call
# 8 times (3.42ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 127, avg 427µs/call
# 8 times (2.16ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 202, avg 269µs/call
# 8 times (1.98ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 225, avg 247µs/call
# 8 times (1.60ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 207, avg 200µs/call | |||||
# spent 1.83s within RTP::Webmerge::Compile::CSS::CORE:substcont which was called 82696 times, avg 22µs/call:
# 65080 times (802ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 207, avg 12µs/call
# 9120 times (64.0ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 114, avg 7µs/call
# 5012 times (938ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 225, avg 187µs/call
# 1632 times (9.90ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 95, avg 6µs/call
# 1632 times (5.93ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 100, avg 4µs/call
# 200 times (3.94ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 226, avg 20µs/call
# 20 times (10.0ms+0s) by RTP::Webmerge::Compile::CSS::compileCSS at line 136, avg 502µs/call |