Ticket #12: test.2.py

File test.2.py, 772 bytes (added by edemaine@…, 8 years ago)

New performance test script

Line 
1import datetime, sys
2try:
3  import syck
4except:
5  print "Couldn't load syck"
6else:
7  t0 = datetime.datetime.now ()
8  cards = syck.load_documents (open (sys.argv[1]))
9  t1 = datetime.datetime.now ()
10  print t1 - t0, 'to read the YAML via Syck'
11try:
12  import yaml
13except:
14  print "Couldn't load PyYAML"
15else:
16  t0 = datetime.datetime.now ()
17  cards = list (yaml.load_all (open (sys.argv[1])))
18  t1 = datetime.datetime.now ()
19  print t1 - t0, 'to read the YAML via PyYAML'
20try:
21  yaml.CLoader
22except:
23  print "Couldn't load PyYAML/LibYAML"
24else:
25  t0 = datetime.datetime.now ()
26  loader = yaml.CLoader (open (sys.argv[1]))
27  while loader.check_data ():
28    #card =
29    loader.get_data ()
30  t1 = datetime.datetime.now ()
31  print t1 - t0, 'to read the YAML via PyYAML/LibYAML'