-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-json.py
More file actions
executable file
·72 lines (37 loc) · 1.02 KB
/
Copy pathtest-json.py
File metadata and controls
executable file
·72 lines (37 loc) · 1.02 KB
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
#!/usr/bin/env python3
import os
import sys
import codecs
import timeit
import json
import cProfile
from jk_logging import *
import jk_json
#bStrict = True
#filePath = "test-strict.json"
bStrict = False
#filePath = "test-relaxed.json"
filePath = "test-performance-test.json"
bDebugging = False
#bDebugging = True
with codecs.open(filePath, "r", "utf-8") as f:
jsonTextData = f.read()
#tokenizer = TokenizerStrict()
#tokenizer = TokenizerRelaxed()
#for token in tokenizer.tokenize(jsonTextData, bDebuggingEnabled = False):
# print(token)
#parser = JsonParserStrict()
#parser = JsonParserRelaxed()
#value = parser.parse(tokenizer.tokenize(jsonTextData))
#print(value)
#print(jk_json.loads(jsonTextData, bStrict = bStrict, bDebugging = bDebugging))
def testMethod():
#jk_json.loads(jsonTextData, bStrict = False, bDebugging = False)
json.loads(jsonTextData)
#
result = timeit.timeit(
testMethod,
number=10000
)
print(result)
jk_json.testPerformance(jsonTextData, "stats-tokenizing.prof", "stats-parsing.prof")