CDC and yaml_bench makefile now always compile with debug
symbols. yaml_bench can now repeat the benchmark many times in a single run. yaml_gen can now disable collection keys in mappings.
This commit is contained in:
parent
13ea5f0c24
commit
915428c8ed
4
cdc.d
4
cdc.d
|
@ -138,7 +138,7 @@ void main(string[] args)
|
|||
|
||||
scope(failure){help(); core.stdc.stdlib.exit(-1);}
|
||||
|
||||
string[] extra_args = ["-w", "-wi"];
|
||||
string[] extra_args = ["-gc", "-w", "-wi"];
|
||||
|
||||
args = args[1 .. $];
|
||||
foreach(arg; args)
|
||||
|
@ -154,7 +154,7 @@ void main(string[] args)
|
|||
}
|
||||
if(args.length > 0 && args[$ - 1][0] != '-'){target = args[$ - 1];}
|
||||
|
||||
string[] dbg = ["-gc", "-debug"];
|
||||
string[] dbg = ["-debug"];
|
||||
string[] optimize = ["-O", "-inline", "-release"];
|
||||
string[] lib_src = ["dyaml/", "yaml.d"];
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
main:
|
||||
dmd -w -I../../ -L-L../../ -L-ldyaml yaml_bench.d
|
||||
dmd -w -gc -I../../ -L-L../../ -L-ldyaml yaml_bench.d
|
||||
|
||||
clean:
|
||||
rm yaml_bench yaml_bench.o
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
|
||||
//Benchmark that loads, and optionally extracts data from and/or emits a YAML file.
|
||||
|
||||
import std.conv;
|
||||
import std.datetime;
|
||||
import std.stdio;
|
||||
import std.string;
|
||||
import yaml;
|
||||
|
||||
///Print help information.
|
||||
|
@ -18,7 +20,8 @@ void help()
|
|||
"Available options:\n"
|
||||
" -h --help Show this help information.\n"
|
||||
" -g --get Extract data from the file (using Node.get()).\n"
|
||||
" -d --dump Dump the loaded data (to YAML_FILE.dump).\n";
|
||||
" -d --dump Dump the loaded data (to YAML_FILE.dump).\n"
|
||||
" -r --runs=NUM Repeat the benchmark NUM times.\n";
|
||||
writeln(help);
|
||||
}
|
||||
|
||||
|
@ -56,16 +59,19 @@ void main(string[] args)
|
|||
{
|
||||
bool get = false;
|
||||
bool dump = false;
|
||||
uint runs = 1;
|
||||
string file = null;
|
||||
|
||||
//Parse command line args
|
||||
foreach(arg; args[1 .. $])
|
||||
{
|
||||
if(arg[0] == '-') switch(arg)
|
||||
auto parts = arg.split("=");
|
||||
if(arg[0] == '-') switch(parts[0])
|
||||
{
|
||||
case "--help", "-h": help(); return;
|
||||
case "--get", "-g": get = true; break;
|
||||
case "--dump", "-d": dump = true; break;
|
||||
case "--runs", "-r": runs = to!uint(parts[1]); break;
|
||||
default: writeln("\nUnknown argument: ", arg, "\n\n"); help(); return;
|
||||
}
|
||||
else
|
||||
|
@ -88,6 +94,8 @@ void main(string[] args)
|
|||
}
|
||||
|
||||
try
|
||||
{
|
||||
while(runs--)
|
||||
{
|
||||
auto nodes = Loader(file).loadAll();
|
||||
if(dump)
|
||||
|
@ -99,6 +107,7 @@ void main(string[] args)
|
|||
extract(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(YAMLException e)
|
||||
{
|
||||
writeln("ERROR: ", e.msg);
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
root-type: seq
|
||||
documents: 2
|
||||
complex-keys: false
|
||||
min-nodes-per-document: 512
|
||||
encoding: utf-32
|
||||
collection-keys: false
|
||||
min-nodes-per-document: 65536
|
||||
encoding: utf-8
|
||||
indent: 4
|
||||
text-width: 40
|
||||
|
||||
|
|
|
@ -155,7 +155,8 @@ Node genBinary(bool root = false)
|
|||
|
||||
Node nodes(in bool root, Node range, in string tag, in bool set = false)
|
||||
{
|
||||
auto types = typesCollection ~ (set ? typesScalarKey : typesScalar);
|
||||
auto types = config["collection-keys"].as!bool ? typesCollection : [];
|
||||
types ~= (set ? typesScalarKey : typesScalar);
|
||||
|
||||
Node[] nodes;
|
||||
if(root)
|
||||
|
|
Loading…
Reference in a new issue