From 5dbdba3c431472db63e033e2b0d0f1aed1d59c7c Mon Sep 17 00:00:00 2001 From: Niels Date: Wed, 11 Dec 2013 10:50:50 +0100 Subject: [PATCH] towards a benchmark --- .gitignore | 3 +++ Makefile.am | 6 +++++- benchmark/JSON_benchmark.cc | 14 ++++++++++++++ benchmark/download.sh | 7 +++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 benchmark/JSON_benchmark.cc create mode 100755 benchmark/download.sh diff --git a/.gitignore b/.gitignore index f2faa7ce..edcbe7a1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ src/.DS_Store .DS_Store + +benchmark/auctions.json +benchmark/citylots.json diff --git a/Makefile.am b/Makefile.am index 158413ca..edbf6030 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -noinst_PROGRAMS = json json98 +noinst_PROGRAMS = json json98 json98benchmark TESTS = ./json ./json98 json_SOURCES = src/JSON.cc src/JSON.h test/JSON_test.cc @@ -9,6 +9,10 @@ json98_SOURCES = src/JSON.cc src/JSON.h test/JSON_test.cc json98_CXXFLAGS = -std=c++98 json98_CPPFLAGS = -I$(top_srcdir)/src +json98benchmark_SOURCES = src/JSON.cc src/JSON.h benchmark/JSON_benchmark.cc +json98benchmark_CXXFLAGS = -std=c++98 -O3 +json98benchmark_CPPFLAGS = -I$(top_srcdir)/src -DNDEBUG + svn-clean: maintainer-clean rm -fr configure INSTALL aclocal.m4 build-aux depcomp install-sh missing test-driver cover_html *.gcda *.gcno coverage*.info for DIR in $(DIST_SUBDIRS) .; do rm -f $$DIR/Makefile.in; done diff --git a/benchmark/JSON_benchmark.cc b/benchmark/JSON_benchmark.cc new file mode 100644 index 00000000..86b57bad --- /dev/null +++ b/benchmark/JSON_benchmark.cc @@ -0,0 +1,14 @@ +#include +#include +#include + +int main(int argc, char** argv) { + JSON json; + std::ifstream infile(argv[1]); + + json << infile; + + std::cout << json.size() << "\n"; + + return 0; +} diff --git a/benchmark/download.sh b/benchmark/download.sh new file mode 100755 index 00000000..377da3b6 --- /dev/null +++ b/benchmark/download.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +git clone https://github.com/zeMirco/sf-city-lots-json.git +mv sf-city-lots-json/citylots.json . +rm -fr sf-city-lots-json + +wget http://eu.battle.net/auction-data/258993a3c6b974ef3e6f22ea6f822720/auctions.json