File: speed.py

package info (click to toggle)
cssutils 2.11.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,312 kB
  • sloc: python: 23,625; javascript: 803; sh: 62; makefile: 8
file content (33 lines) | stat: -rw-r--r-- 767 bytes parent folder | download
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
import timeit

do = """
import cssutils
css = '''
@font-face {
  font-family: 'WebFont';
  src: url('myfont.eot');  /* IE6-8 */
  src: local('xxx'),
        url('myfont.woff') format('woff'),  /* FF3.6, IE9 */
        url('myfont.ttf') format('truetype');  /* Saf3+,Chrome,FF3.5,Opera10+ */
}
a {
/**//**//**//**//**//**//**//**/
/**//**//**//**//**//**//**//**/
color: red;
display: none;
position: absolute;
left: 1px;
top: 2px;
background: 1px url(x) no-repeat left top;
padding: 1px 1px 2px 5cm;
font: normal 1px/5em Arial, sans-serif;

}    '''
p = cssutils.CSSParser(parseComments=False)
sheet = p.parseString(10*css)
"""
t = timeit.Timer(do)  # outside the try/except
try:
    print(t.timeit(20))  # or t.repeat(...)
except Exception:
    print(t.print_exc())