A benchmark Loader method that scans a file but throws away the tokens.

This commit is contained in:
Ferdinand Majerech 2014-08-02 23:26:46 +02:00
parent c160156346
commit 6aa50b8898

View file

@ -360,6 +360,21 @@ struct Loader
} }
} }
// Scan all tokens, throwing them away. Used for benchmarking.
void scanBench() @safe
{
try while(scanner_.checkToken())
{
scanner_.getToken();
}
catch(YAMLException e)
{
throw new YAMLException("Unable to scan YAML from stream " ~
name_ ~ " : " ~ e.msg);
}
}
// Parse and return all events. Used for debugging. // Parse and return all events. Used for debugging.
immutable(Event)[] parse() @safe immutable(Event)[] parse() @safe
{ {