-
Notifications
You must be signed in to change notification settings - Fork 0
/
sac-mark.html
228 lines (228 loc) · 13.9 KB
/
sac-mark.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<!DOCTYPE html><html lang="en"><head>
<title>CSS4J SAC benchmarks</title>
<link href="basic-c.css" rel="stylesheet" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<div class="layout">
<div id="hdr01"></div>
<a id="mylinkhome" href="/"><span>CSS4J</span></a>
</div>
<div class="container">
<div class="menu">
<ul class="menulist">
<li><a id="mnuindice" href="/"><span>Home</span></a></li>
<li><a id="mnuusage" href="usage.html"><span>Usage</span></a></li>
<li><a id="mnuapi2" href="api/latest/"><span>Latest API</span></a></li>
<li><a id="mnufaq" href="faq.html"><span>FAQ</span></a></li>
<li><a id="mnubenchmarks" href="benchmarks.html"><span>Benchmarks</span></a></li>
<li class="menulvl2"><a id="mnudommark" href="dom-mark.html"><span>DOM mark</span></a></li>
<li class="menulvl2"><div id="mnusacmark-sel"><span>SAC mark</span></div></li>
<li><a id="mnugithub" href="https://github.com/css4j"><span>Github</span></a></li>
</ul>
</div>
<div class="beforemain"></div>
<div class="main">
<div id="presentacion_top" class="textheader"><span>SAC mark</span></div>
<div class="cos">
<h1>SAC benchmarks</h1>
<div class="tema" id="overview">
<h2>Overview</h2>
<p>The SAC benchmarks measure how fast different <a href="http://www.w3.org/Style/CSS/SAC/">SAC</a> implementations parse CSS style sheets. The following software versions were used:</p>
<ul>
<li>Java: <a href="https://adoptopenjdk.net/">AdoptOpenJDK</a> 15.</li>
<li>JMH: 1.26.</li>
<li>css4j: 1.2.</li>
<li><a href="https://xmlgraphics.apache.org/batik/">Batik</a>: 1.13.</li>
<li><a href="https://sourceforge.net/projects/cssparser/">SteadyState CSSParser</a>: 0.9.29.</li>
</ul>
<p>The computer has an Intel® Core™ i5-1035G7 CPU and 8GB of RAM.</p>
<p>Please note that css4j 1.<i>x</i> versions are superseded, and later versions use NSAC 2.1 instead of SAC.</p>
</div>
<div class="tema" id="sac-mark">
<h2>SAC benchmark</h2>
<p>Measures the speed at which the SAC parser can process a sample style sheet (contains a subset of the HTML5 user agent's sheet, and then a mix of common style rules).
</p>
<p>Given that in css4j 1.<i>x</i> you can choose your preferred SAC parser, this benchmark may be of help.</p>
<p>The results come from <a href="https://github.com/css4j/benchmark/blob/css4j-1.x/src/io/sf/carte/mark/css/SACBenchmark.java">SACBenchmark</a>.</p>
<div class="tema" id="sac-226kb"><h3>Medium-large file (226 kB)</h3>
<svg version="1.1" baseprofile="full" xmlns="http://www.w3.org/2000/svg" width="700" height="500" viewbox="0 0 700 500" class="carteitem">
<title>SAC benchmark</title><defs>
<clipPath id="sac-226kb-cut-scale-shadow">
<rect width="623" height="15" x="71" y="41"/>
<rect width="8" height="418" x="685" y="37"/>
</clipPath>
<linearGradient id="sac-226kb-background" gradientunits="objectBoundingBox" x1="1" x2="1" y1="0" y2="1">
<stop stop-color="#cde1ff" offset="0"/>
<stop stop-color="#ffffff" offset="0.9"/>
</linearGradient>
<linearGradient id="sac-226kb-reflection" gradientunits="objectBoundingBox" x1="0" x2="0" y1="0" y2="1">
<stop stop-color="#eeeeee" offset="0" stop-opacity="0.4"/>
<stop stop-color="#ffffff" offset="0.75" stop-opacity="0"/>
</linearGradient>
<filter id="sac-226kb-projection" filterunits="objectBoundingBox" x="0" y="-0.1" width="1.2" height="1.2">
<feGaussianBlur in="SourceAlpha" stddeviation="2" result="alpha_blur"/>
<feOffset in="alpha_blur" dx="3" dy="-3" result="offset_alpha_blur"/>
</filter>
</defs>
<style>text {
font-family: "Open Sans", Verdana, sans-serif;
}
#sac-226kb-caption {
font-size: 13pt;
font-weight: 700;
}
#sac-226kb-subcaption {
font-size: 9pt;
font-weight: 600;
}
#sac-226kb-x-title,#sac-226kb-y-title {
font-size: 10pt;
font-weight: 700;
}
.sac-226kb-itemlabel {
font-size: 9pt;
font-weight: 400;
}
.sac-226kb-scaleItem {
font-size: 9pt;
font-weight: 300;
}
</style>
<rect width="100%" height="100%" fill="url('#sac-226kb-background')"/>
<rect width="610" height="400" x="75" y="55" stroke="#000000" fill="rgb(0,0,0)" fill-opacity="0" filter="url('#sac-226kb-projection')" clip-path="url('#sac-226kb-cut-scale-shadow')"/>
<rect id="sac-226kb-chartbox" width="610" height="400" x="75" y="55" stroke-width="1" stroke="#000000" fill="rgb(0,0,0)" fill-opacity="0"/>
<text id="sac-226kb-caption" x="355" y="22" text-anchor="middle" fill="black">SAC benchmark</text>
<text id="sac-226kb-subcaption" x="355" y="40" text-anchor="middle" fill="black">Medium-large file (226 kB)</text>
<rect width="187.0" height="223" x="81.5" y="232" stroke="#ffffff" stroke-opacity="0.4" filter="url('#sac-226kb-projection')"/>
<rect id="sac-226kb-markSACParseStyleSheet" width="187.0" height="223" x="81.5" y="232" stroke="black" stroke-width="0.4" stroke-opacity="0.3" fill="#c04d4d"/>
<rect width="187.0" height="223" x="81.5" y="232" fill="url('#sac-226kb-reflection')"/>
<line x1="179.1" x2="179.1" y1="224.4" y2="239.6" stroke="#888888" stroke-opacity="0.867" stroke-width="5" stroke-linecap="round" stroke-dasharray="1" class="errorbar"/>
<text x="174.1" y="470" class="itemlabel" text-anchor="middle" fill="black">Css4j</text>
<rect width="187.0" height="387.2" x="284.9" y="67.8" stroke="#ffffff" stroke-opacity="0.4" filter="url('#sac-226kb-projection')"/>
<rect id="sac-226kb-markSACParseStyleSheetBatik" width="187.0" height="387.2" x="284.9" y="67.8" stroke="black" stroke-width="0.4" stroke-opacity="0.3" fill="#61c061"/>
<rect width="187.0" height="387.2" x="284.9" y="67.8" fill="url('#sac-226kb-reflection')"/>
<line x1="382.5" x2="382.5" y1="65.9" y2="70.1" stroke="#888888" stroke-opacity="0.867" stroke-width="5" stroke-linecap="round" stroke-dasharray="1" class="errorbar"/>
<text x="377.4" y="470" class="itemlabel" text-anchor="middle" fill="black">Batik CSS</text>
<rect width="187.0" height="7" x="488.2" y="448" stroke="#ffffff" stroke-opacity="0.4" filter="url('#sac-226kb-projection')"/>
<rect id="sac-226kb-markSACParseStyleSheetSSParser" width="187.0" height="7" x="488.2" y="448" stroke="black" stroke-width="0.4" stroke-opacity="0.3" fill="#4d4dc0"/>
<rect width="187.0" height="7" x="488.2" y="448" fill="url('#sac-226kb-reflection')"/>
<line x1="585.8" x2="585.8" y1="447.9" y2="448.1" stroke="#888888" stroke-opacity="0.867" stroke-width="5" stroke-linecap="round" stroke-dasharray="1" class="errorbar"/>
<text x="580.7" y="470" class="itemlabel" text-anchor="middle" fill="black">SS CSSParser</text>
<text x="74" y="59" class="scaleitem" text-anchor="end">380</text>
<text x="74" y="139" class="scaleitem" text-anchor="end">304</text>
<text x="74" y="219" class="scaleitem" text-anchor="end">228</text>
<text x="74" y="299" class="scaleitem" text-anchor="end">152</text>
<text x="74" y="379" class="scaleitem" text-anchor="end">76</text>
<text x="74" y="459" class="scaleitem" text-anchor="end">0</text>
<text id="sac-226kb-y-title" x="16" y="260" text-anchor="middle" fill="black" transform="rotate(270,16,260)">Throughput (ops/s)</text>
<text id="sac-226kb-x-title" x="350" y="496" text-anchor="middle" fill="black">SAC Implementation</text>
<image src="benchmark/sac-226kb.png" xlink:href=""/></svg>
<p>Numeric results (higher is better):</p>
<table class="normaltbl carteitem">
<thead><tr><th>Implementation</th><th>Score</th><th>Error</th><th>Unit</th></tr></thead>
<tbody>
<tr><td>Css4j</td><td class="number">213.9596</td><td class="number">±7.2496</td><td>ops/s</td></tr>
<tr><td>Batik CSS</td><td class="number">371.5772</td><td class="number">±2.0175</td><td>ops/s</td></tr>
<tr><td>SS CSSParser</td><td class="number">6.7046</td><td class="number">±0.0571</td><td>ops/s</td></tr>
</tbody></table></div>
<div class="tema" id="sac-small"><h3>Small file (13 kB)</h3>
<svg version="1.1" baseprofile="full" xmlns="http://www.w3.org/2000/svg" width="700" height="500" viewbox="0 0 700 500" class="carteitem">
<title>SAC benchmark</title><defs>
<clipPath id="sac-small-cut-scale-shadow">
<rect width="623" height="15" x="71" y="41"/>
<rect width="8" height="418" x="685" y="37"/>
</clipPath>
<linearGradient id="sac-small-background" gradientunits="objectBoundingBox" x1="1" x2="1" y1="0" y2="1">
<stop stop-color="#cde1ff" offset="0"/>
<stop stop-color="#ffffff" offset="0.9"/>
</linearGradient>
<linearGradient id="sac-small-reflection" gradientunits="objectBoundingBox" x1="0" x2="0" y1="0" y2="1">
<stop stop-color="#eeeeee" offset="0" stop-opacity="0.4"/>
<stop stop-color="#ffffff" offset="0.75" stop-opacity="0"/>
</linearGradient>
<filter id="sac-small-projection" filterunits="objectBoundingBox" x="0" y="-0.1" width="1.2" height="1.2">
<feGaussianBlur in="SourceAlpha" stddeviation="2" result="alpha_blur"/>
<feOffset in="alpha_blur" dx="3" dy="-3" result="offset_alpha_blur"/>
</filter>
</defs>
<style>text {
font-family: "Open Sans", Verdana, sans-serif;
}
#sac-small-caption {
font-size: 13pt;
font-weight: 700;
}
#sac-small-subcaption {
font-size: 9pt;
font-weight: 600;
}
#sac-small-x-title,#sac-small-y-title {
font-size: 10pt;
font-weight: 700;
}
.sac-small-itemlabel {
font-size: 9pt;
font-weight: 400;
}
.sac-small-scaleItem {
font-size: 9pt;
font-weight: 300;
}
</style>
<rect width="100%" height="100%" fill="url('#sac-small-background')"/>
<rect width="610" height="400" x="75" y="55" stroke="#000000" fill="rgb(0,0,0)" fill-opacity="0" filter="url('#sac-small-projection')" clip-path="url('#sac-small-cut-scale-shadow')"/>
<rect id="sac-small-chartbox" width="610" height="400" x="75" y="55" stroke-width="1" stroke="#000000" fill="rgb(0,0,0)" fill-opacity="0"/>
<text id="sac-small-caption" x="355" y="22" text-anchor="middle" fill="black">SAC benchmark</text>
<text id="sac-small-subcaption" x="355" y="40" text-anchor="middle" fill="black">Small file (13 kB)</text>
<rect width="187.0" height="222.7" x="81.5" y="232.3" stroke="#ffffff" stroke-opacity="0.4" filter="url('#sac-small-projection')"/>
<rect id="sac-small-markSACParseStyleSheet" width="187.0" height="222.7" x="81.5" y="232.3" stroke="black" stroke-width="0.4" stroke-opacity="0.3" fill="#c04d4d"/>
<rect width="187.0" height="222.7" x="81.5" y="232.3" fill="url('#sac-small-reflection')"/>
<line x1="179.1" x2="179.1" y1="223" y2="241" stroke="#888888" stroke-opacity="0.867" stroke-width="5" stroke-linecap="round" stroke-dasharray="1" class="errorbar"/>
<text x="174.1" y="470" class="itemlabel" text-anchor="middle" fill="black">Css4j</text>
<rect width="187.0" height="385.4" x="284.9" y="69.6" stroke="#ffffff" stroke-opacity="0.4" filter="url('#sac-small-projection')"/>
<rect id="sac-small-markSACParseStyleSheetBatik" width="187.0" height="385.4" x="284.9" y="69.6" stroke="black" stroke-width="0.4" stroke-opacity="0.3" fill="#61c061"/>
<rect width="187.0" height="385.4" x="284.9" y="69.6" fill="url('#sac-small-reflection')"/>
<line x1="382.5" x2="382.5" y1="67" y2="73" stroke="#888888" stroke-opacity="0.867" stroke-width="5" stroke-linecap="round" stroke-dasharray="1" class="errorbar"/>
<text x="377.4" y="470" class="itemlabel" text-anchor="middle" fill="black">Batik CSS</text>
<rect width="187.0" height="8.7" x="488.2" y="446.3" stroke="#ffffff" stroke-opacity="0.4" filter="url('#sac-small-projection')"/>
<rect id="sac-small-markSACParseStyleSheetSSParser" width="187.0" height="8.7" x="488.2" y="446.3" stroke="black" stroke-width="0.4" stroke-opacity="0.3" fill="#4d4dc0"/>
<rect width="187.0" height="8.7" x="488.2" y="446.3" fill="url('#sac-small-reflection')"/>
<line x1="585.8" x2="585.8" y1="445.9" y2="446.1" stroke="#888888" stroke-opacity="0.867" stroke-width="5" stroke-linecap="round" stroke-dasharray="1" class="errorbar"/>
<text x="580.7" y="470" class="itemlabel" text-anchor="middle" fill="black">SS CSSParser</text>
<text x="74" y="59" class="scaleitem" text-anchor="end">6700</text>
<text x="74" y="139" class="scaleitem" text-anchor="end">5360</text>
<text x="74" y="219" class="scaleitem" text-anchor="end">4020</text>
<text x="74" y="299" class="scaleitem" text-anchor="end">2680</text>
<text x="74" y="379" class="scaleitem" text-anchor="end">1340</text>
<text x="74" y="459" class="scaleitem" text-anchor="end">0</text>
<text id="sac-small-y-title" x="16" y="260" text-anchor="middle" fill="black" transform="rotate(270,16,260)">Throughput (ops/s)</text>
<text id="sac-small-x-title" x="350" y="496" text-anchor="middle" fill="black">SAC Implementation</text>
<image src="benchmark/sac-small.png" xlink:href=""/></svg>
<p>Numeric results (higher is better):</p>
<table class="normaltbl carteitem">
<thead><tr><th>Implementation</th><th>Score</th><th>Error</th><th>Unit</th></tr></thead>
<tbody>
<tr><td>Css4j</td><td class="number">3,767.20</td><td class="number">±152.24</td><td>ops/s</td></tr>
<tr><td>Batik CSS</td><td class="number">6,521.44</td><td class="number">±51.31</td><td>ops/s</td></tr>
<tr><td>SS CSSParser</td><td class="number">146.39</td><td class="number">±1.05</td><td>ops/s</td></tr>
</tbody></table></div>
</div>
<div class="tema" id="analysis">
<h2>Analysis</h2>
<p>Batik has the fastest SAC parser: 1.7 times the throughput of css4j's, 45-55 times faster than SS CSSParser (depending on the file size) although it only supports CSS2 (and not in full).
Also, in other tests has shown bad error recovery, causing it to yield (bogus) faster benchmarks if (unsupported) CSS3 is found. On the other hand, the css4j's
SAC parser supports more CSS than the other contenders and is still reasonably fast.</p>
<p>The css4j's SAC parser is recommended by this project to use with css4j's 1.x Object Model (it is the default parser). However, if your use
case only requires simple level 2 selectors and values, and performance is the main consideration (like when CSS is used to specify the user interface
of a Java application), Batik's parser could be adequate.</p>
<p>The SteadyState CSSParser is the slowest and, although has recently improved its support for level 3 values, unfortunately its implementation of <code>calc()</code> has some quirks
and is incompatible with css4j 1.x.</p>
</div>
</div>
<div class="footnote">
</div>
</div>
</div>
</body></html>