summaryrefslogtreecommitdiffstats
path: root/llvm/utils/yaml-bench/YAMLBench.cpp
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2014-06-26 22:52:05 +0000
committerAlp Toker <alp@nuanti.com>2014-06-26 22:52:05 +0000
commite69170a11079504e1b20ec79296925f295dc01c0 (patch)
tree7c415eb6c14f0afb0e97e42d6ba2579dd897fb3a /llvm/utils/yaml-bench/YAMLBench.cpp
parent11c6f6165b76a42da7eaf4514e419be397d7fc44 (diff)
downloadbcm5719-llvm-e69170a11079504e1b20ec79296925f295dc01c0.tar.gz
bcm5719-llvm-e69170a11079504e1b20ec79296925f295dc01c0.zip
Revert "Introduce a string_ostream string builder facilty"
Temporarily back out commits r211749, r211752 and r211754. llvm-svn: 211814
Diffstat (limited to 'llvm/utils/yaml-bench/YAMLBench.cpp')
-rw-r--r--llvm/utils/yaml-bench/YAMLBench.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/llvm/utils/yaml-bench/YAMLBench.cpp b/llvm/utils/yaml-bench/YAMLBench.cpp
index c3c7c152c2c..39b8f72ecc5 100644
--- a/llvm/utils/yaml-bench/YAMLBench.cpp
+++ b/llvm/utils/yaml-bench/YAMLBench.cpp
@@ -166,21 +166,23 @@ static void benchmark( llvm::TimerGroup &Group
}
static std::string createJSONText(size_t MemoryMB, unsigned ValueSize) {
- llvm::string_ostream OS;
- OS << "[\n";
+ std::string JSONText;
+ llvm::raw_string_ostream Stream(JSONText);
+ Stream << "[\n";
size_t MemoryBytes = MemoryMB * 1024 * 1024;
- while (OS.tell() < MemoryBytes) {
- OS << " {\n"
- << " \"key1\": \"" << std::string(ValueSize, '*') << "\",\n"
- << " \"key2\": \"" << std::string(ValueSize, '*') << "\",\n"
- << " \"key3\": \"" << std::string(ValueSize, '*') << "\"\n"
- << " }";
- if (OS.tell() < MemoryBytes)
- OS << ",";
- OS << "\n";
+ 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";
}
- OS << "]\n";
- return OS.str();
+ Stream << "]\n";
+ Stream.flush();
+ return JSONText;
}
int main(int argc, char **argv) {
OpenPOWER on IntegriCloud