summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/Makefile2
-rw-r--r--utils/json-bench/CMakeLists.txt5
-rw-r--r--utils/json-bench/JSONBench.cpp85
-rw-r--r--utils/json-bench/Makefile21
4 files changed, 1 insertions, 112 deletions
diff --git a/utils/Makefile b/utils/Makefile
index b98376006e..ecb30bed7c 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -9,7 +9,7 @@
LEVEL = ..
PARALLEL_DIRS := FileCheck FileUpdate TableGen PerfectShuffle \
- count fpcmp llvm-lit not unittest json-bench
+ count fpcmp llvm-lit not unittest
EXTRA_DIST := check-each-file codegen-diff countloc.sh \
DSAclean.py DSAextract.py emacs findsym.pl GenLibDeps.pl \
diff --git a/utils/json-bench/CMakeLists.txt b/utils/json-bench/CMakeLists.txt
deleted file mode 100644
index 03ac51ce64..0000000000
--- a/utils/json-bench/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-add_llvm_utility(json-bench
- JSONBench.cpp
- )
-
-target_link_libraries(json-bench LLVMSupport)
diff --git a/utils/json-bench/JSONBench.cpp b/utils/json-bench/JSONBench.cpp
deleted file mode 100644
index ca8a36a03a..0000000000
--- a/utils/json-bench/JSONBench.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-//===- JSONBench - Benchmark the JSONParser implementation ----------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This program executes the JSONParser on differntly sized JSON texts and
-// outputs the run time.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/ADT/Twine.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/JSONParser.h"
-#include "llvm/Support/Timer.h"
-#include "llvm/Support/raw_ostream.h"
-
-static llvm::cl::opt<bool>
-Verify("verify", llvm::cl::desc(
- "Run a quick verification useful for regression testing"),
- llvm::cl::init(false));
-
-static llvm::cl::opt<unsigned>
-MemoryLimitMB("memory-limit", llvm::cl::desc(
- "Do not use more megabytes of memory"),
- llvm::cl::init(1000));
-
-void benchmark(llvm::TimerGroup &Group, llvm::StringRef Name,
- llvm::StringRef JSONText) {
- llvm::Timer BaseLine((Name + ": Loop").str(), Group);
- BaseLine.startTimer();
- char C = 0;
- for (llvm::StringRef::iterator I = JSONText.begin(),
- E = JSONText.end();
- I != E; ++I) { C += *I; }
- BaseLine.stopTimer();
- volatile char DontOptimizeOut = C; (void)DontOptimizeOut;
-
- llvm::Timer Parsing((Name + ": Parsing").str(), Group);
- Parsing.startTimer();
- llvm::SourceMgr SM;
- llvm::JSONParser Parser(JSONText, &SM);
- if (!Parser.validate()) {
- llvm::errs() << "Parsing error in JSON parser benchmark.\n";
- exit(1);
- }
- Parsing.stopTimer();
-}
-
-std::string createJSONText(size_t MemoryMB, unsigned ValueSize) {
- std::string JSONText;
- llvm::raw_string_ostream Stream(JSONText);
- Stream << "[\n";
- size_t MemoryBytes = MemoryMB * 1024 * 1024;
- while (JSONText.size() < MemoryBytes) {
- Stream << " {\n"
- << " \"key1\": \"" << std::string(ValueSize, '*') << "\",\n"
- << " \"key2\": \"" << std::string(ValueSize, '*') << "\",\n"
- << " \"key3\": \"" << std::string(ValueSize, '*') << "\"\n"
- << " }";
- Stream.flush();
- if (JSONText.size() < MemoryBytes) Stream << ",";
- Stream << "\n";
- }
- Stream << "]\n";
- Stream.flush();
- return JSONText;
-}
-
-int main(int argc, char **argv) {
- llvm::cl::ParseCommandLineOptions(argc, argv);
- llvm::TimerGroup Group("JSON parser benchmark");
- if (Verify) {
- benchmark(Group, "Fast", createJSONText(10, 500));
- } else {
- benchmark(Group, "Small Values", createJSONText(MemoryLimitMB, 5));
- benchmark(Group, "Medium Values", createJSONText(MemoryLimitMB, 500));
- benchmark(Group, "Large Values", createJSONText(MemoryLimitMB, 50000));
- }
- return 0;
-}
-
diff --git a/utils/json-bench/Makefile b/utils/json-bench/Makefile
deleted file mode 100644
index 6651626f68..0000000000
--- a/utils/json-bench/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-##===- utils/FileCheck/Makefile ----------------------------*- Makefile -*-===##
-#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = ../..
-TOOLNAME = json-bench
-USEDLIBS = LLVMSupport.a
-
-# This tool has no plugins, optimize startup time.
-TOOL_NO_EXPORTS = 1
-
-# Don't install this utility
-NO_INSTALL = 1
-
-include $(LEVEL)/Makefile.common
-