diff options
author | Lars Wirzenius <liw@liw.fi> | 2018-03-17 11:13:34 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2018-03-17 11:40:02 +0200 |
commit | e92515e92689e1a9b7950f936758b191bc61c33a (patch) | |
tree | c7edb159ba5a655405cc9c63a0ce16bc523f3a2b /prettyml | |
parent | c964fa3e4312b83cd20b6d47fabcee290a1ab1c7 (diff) | |
download | extrautils-e92515e92689e1a9b7950f936758b191bc61c33a.tar.gz |
Change: load using CSafeLoader, for speed
With a 9 MiB input file with 10,000 dicts, SafeLoader loads it in
about 10 seconds on my laptop, CSafeLoader in about 0.5 seconds.
That's a 20x speed improvement with a one-character change.
Diffstat (limited to 'prettyml')
-rwxr-xr-x | prettyml | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -15,5 +15,5 @@ def inputs(args): objs = [] for filename, f in inputs(sys.argv[1:]): - objs.append(yaml.safe_load(f)) + objs.append(yaml.load(f, Loader=yaml.CSafeLoader)) yaml.safe_dump_all(objs, stream=sys.stdout, indent=4, default_flow_style=False) |