mirror of
https://github.com/nlohmann/json.git
synced 2024-11-27 16:49:02 +08:00
benchmark
This commit is contained in:
parent
5dbdba3c43
commit
d1ac3d9938
@ -1,14 +1,17 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <ctime>
|
||||
#include <JSON.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
time_t timer1, timer2;
|
||||
|
||||
JSON json;
|
||||
std::ifstream infile(argv[1]);
|
||||
|
||||
time(&timer1);
|
||||
json << infile;
|
||||
|
||||
std::cout << json.size() << "\n";
|
||||
time(&timer2);
|
||||
std::cout << "Parsing from std::ifstream: " << difftime(timer2, timer1) << " sec\n";
|
||||
|
||||
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_CONFIG_SRCDIR([src/JSON.cc])
|
||||
|
||||
AM_INIT_AUTOMAKE([foreign])
|
||||
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
||||
AM_SILENT_RULES([yes])
|
||||
|
||||
AC_PROG_CXX
|
||||
|
Loading…
Reference in New Issue
Block a user