Commit 99c98e9c authored by Grant Likely's avatar Grant Likely Committed by Vincent Stehlé
Browse files

Speed up yaml output by using CDumper



The libyaml implementation is significantly faster than the pure python
YAML parser. If it is present, then use CDumper when dumping the
results.
Signed-off-by: Grant Likely's avatarGrant Likely <grant.likely@arm.com>
[Rebased, added conditional.]
Signed-off-by: Vincent Stehlé's avatarVincent Stehlé <vincent.stehle@arm.com>
parent 5c89ff4b
......@@ -13,6 +13,12 @@ try:
except ImportError:
print('No yaml...')
if 'yaml' in sys.modules:
try:
from yaml import CDumper as Dumper
except ImportError:
from yaml import Dumper
#based loosley on https://stackoverflow.com/a/4391978
# returns a filtered dict of dicts that meet some Key-value pair.
......@@ -343,7 +349,7 @@ def gen_yaml(cross_check, filename):
logging.debug(f'Generate {filename}')
with open(filename, 'w') as yamlfile:
yaml.dump(cross_check, yamlfile)
yaml.dump(cross_check, yamlfile, Dumper=Dumper)
# Combine or two databases db1 and db2 coming from ekl and seq files
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment