~mnordhoff/loggerhead/cheezum

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
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

"""
Import loggerhead and its dependencies to get them in the disk cache so it
will start more quickly.
"""

import compileall
import sys
import time

t_start = time.time()
import bzrlib
t_bzr = time.time()
import loggerhead
t_lh = time.time()
import paste
t_paste = time.time()
import simplejson
t_json = time.time()
import simpletal
t_tal = time.time()

# This isn't really relevant to this script, but I need to do it at the same
# time anyway, so..
compileall.compile_dir('/home/mnordhoff/loggerhead/loggerhead', quiet=True)

template = ("Imported bzrlib in %s, loggerhead in %s, paste in %s, simplejson "
    "in %s, and simpletal in %s")

if len(sys.argv) > 1 and sys.argv[1] in ('-v', '--verbose'):
    fmt = template.replace('%', '%r')
else:
    fmt = template.replace('%', '%f')
print fmt % (t_bzr - t_start, t_lh - t_bzr, t_paste - t_lh, t_json - t_paste,
    t_tal - t_json)