benchmark
This commit is contained in:
parent
5dbdba3c43
commit
d1ac3d9938
3 changed files with 18 additions and 4 deletions
|
@ -1,14 +1,17 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <ctime>
|
||||||
#include <JSON.h>
|
#include <JSON.h>
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
time_t timer1, timer2;
|
||||||
|
|
||||||
JSON json;
|
JSON json;
|
||||||
std::ifstream infile(argv[1]);
|
std::ifstream infile(argv[1]);
|
||||||
|
time(&timer1);
|
||||||
json << infile;
|
json << infile;
|
||||||
|
time(&timer2);
|
||||||
std::cout << json.size() << "\n";
|
std::cout << "Parsing from std::ifstream: " << difftime(timer2, timer1) << " sec\n";
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
11
benchmark/benchmark.py
Executable file
11
benchmark/benchmark.py
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
a = datetime.datetime.now()
|
||||||
|
data = json.loads(open(sys.argv[1]).read())
|
||||||
|
b = datetime.datetime.now()
|
||||||
|
|
||||||
|
print (b-a)
|
|
@ -1,7 +1,7 @@
|
||||||
AC_INIT([JSON], [1.0], [niels.lohmann@uni-rostock.de])
|
AC_INIT([JSON], [1.0], [niels.lohmann@uni-rostock.de])
|
||||||
AC_CONFIG_SRCDIR([src/JSON.cc])
|
AC_CONFIG_SRCDIR([src/JSON.cc])
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([foreign])
|
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
|
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
|
|
Loading…
Reference in a new issue