Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add "short append" benchmark to fbstring benchmark suite.

Summary:
Appending many small strings to fbstring appears much slower (~3x) vs.
std::string. Adding benchmark case to illustrate.

[If this isn't wanted, I can revert]

Test Plan: This is a benchmark.

Reviewed By: soren@fb.com

FB internal diff: D544159
  • Loading branch information...
commit be7be7e244159b84c0a28d8082ef06f81cac83bc 1 parent 5d3f05b
Jeremy Lilley authored tudor committed
Showing with 11 additions and 0 deletions.
  1. +11 −0 folly/test/FBStringTestBenchmarks.cpp.h
View
11 folly/test/FBStringTestBenchmarks.cpp.h
@@ -222,3 +222,14 @@ BENCHMARK_PARAM(BENCHFUN(push_back), 1);
BENCHMARK_PARAM(BENCHFUN(push_back), 23);
BENCHMARK_PARAM(BENCHFUN(push_back), 127);
BENCHMARK_PARAM(BENCHFUN(push_back), 1024);
+
+void BENCHFUN(short_append)(int iters, int arg) {
+ FOR_EACH_RANGE (i, 0, iters) {
+ STRING s;
+ FOR_EACH_RANGE (j, 0, arg) {
+ s += "012";
+ }
+ }
+}
+BENCHMARK_PARAM(BENCHFUN(short_append), 23);
+BENCHMARK_PARAM(BENCHFUN(short_append), 1024);
Please sign in to comment.
Something went wrong with that request. Please try again.