proxygen
UriBenchmark.cpp File Reference
#include <folly/Uri.h>
#include <folly/Benchmark.h>
#include <folly/init/Init.h>

Go to the source code of this file.

Functions

 BENCHMARK (init_uri_simple, iters)
 
 BENCHMARK (init_uri_simple_with_query_parsing, iters)
 
 BENCHMARK (init_uri_complex, iters)
 
 BENCHMARK (init_uri_complex_with_query_parsing, iters)
 
int main (int argc, char **argv)
 

Function Documentation

BENCHMARK ( init_uri_simple  ,
iters   
)

Result of benchmark varies by the complexity of query.

folly/test/UriTest.cpp relative time/iter iters/s

init_uri_simple 4.88us 204.80K init_uri_simple_with_query_parsing 22.46us 44.52K init_uri_complex 5.92us 168.85K

init_uri_complex_with_query_parsing 48.70us 20.53K

Definition at line 35 of file UriBenchmark.cpp.

References i, and s.

35  {
36  const fbstring s("http://localhost?&key1=foo&key2=&key3&=bar&=bar=&");
37  for (size_t i = 0; i < iters; ++i) {
38  Uri u(s);
39  }
40 }
Definition: Uri.h:43
static set< string > s
BENCHMARK ( init_uri_simple_with_query_parsing  ,
iters   
)

Definition at line 42 of file UriBenchmark.cpp.

References folly::Uri::getQueryParams(), i, and s.

42  {
43  const fbstring s("http://localhost?&key1=foo&key2=&key3&=bar&=bar=&");
44  for (size_t i = 0; i < iters; ++i) {
45  Uri u(s);
46  u.getQueryParams();
47  }
48 }
Definition: Uri.h:43
static set< string > s
BENCHMARK ( init_uri_complex  ,
iters   
)

Definition at line 50 of file UriBenchmark.cpp.

References i, and s.

50  {
51  const fbstring s(
52  "https://mock.example.com/farm/track.php?TmOxQUDF=uSmTS_VwhjKnh_JME&DI"
53  "h=fbbN&GRsoIm=bGshjaUqavZxQai&UMT=36k18N4dn21&3U=CD8o4A4497W152j6m0V%14"
54  "%57&Hy=t%05mpr.80JUZ7ne_%23zS8DcA%0qc_%291ymamz096%11Zfb3r%09ZqPD%311ZX"
55  "tqJd600ot&5U96U-Rh-VZ=-D_6-9xKYj%1gW6b43s1B9-j21P0oUW5-t46G4kgt&ezgj=mcW"
56  "TTQ.c&Oh=%2PblUfuC%7C997048884827569%03xnyJ%2L1pi7irBioQ6D4r7nNHNdo6v7Y%"
57  "84aurnSJ%2wCFePHMlGZmIHGfCe7392_lImWsSvN&sBeNN=Nf%80yOE%6X10M64F4gG197aX"
58  "R2B4g2533x235A0i4e%57%58uWB%04Erw.60&VMS4=Ek_%02GC0Pkx%6Ov_%207WICUz007%"
59  "04nYX8N%46zzpv%999h&KGmBt988y=q4P57C-Dh-Nz-x_7-5oPxz%1gz3N03t6c7-R67N4DT"
60  "Y6-f98W1&Lts&%02dOty%8eEYEnLz4yexQQLnL4MGU2JFn3OcmXcatBcabZgBdDdy67hdgW"
61  "tYn4");
62  for (size_t i = 0; i < iters; ++i) {
63  Uri u(s);
64  }
65 }
Definition: Uri.h:43
static set< string > s
BENCHMARK ( init_uri_complex_with_query_parsing  ,
iters   
)

Definition at line 67 of file UriBenchmark.cpp.

References folly::Uri::getQueryParams(), i, and s.

67  {
68  const fbstring s(
69  "https://mock.example.com/farm/track.php?TmOxQUDF=uSmTS_VwhjKnh_JME&DI"
70  "h=fbbN&GRsoIm=bGshjaUqavZxQai&UMT=36k18N4dn21&3U=CD8o4A4497W152j6m0V%14"
71  "%57&Hy=t%05mpr.80JUZ7ne_%23zS8DcA%0qc_%291ymamz096%11Zfb3r%09ZqPD%311ZX"
72  "tqJd600ot&5U96U-Rh-VZ=-D_6-9xKYj%1gW6b43s1B9-j21P0oUW5-t46G4kgt&ezgj=mcW"
73  "TTQ.c&Oh=%2PblUfuC%7C997048884827569%03xnyJ%2L1pi7irBioQ6D4r7nNHNdo6v7Y%"
74  "84aurnSJ%2wCFePHMlGZmIHGfCe7392_lImWsSvN&sBeNN=Nf%80yOE%6X10M64F4gG197aX"
75  "R2B4g2533x235A0i4e%57%58uWB%04Erw.60&VMS4=Ek_%02GC0Pkx%6Ov_%207WICUz007%"
76  "04nYX8N%46zzpv%999h&KGmBt988y=q4P57C-Dh-Nz-x_7-5oPxz%1gz3N03t6c7-R67N4DT"
77  "Y6-f98W1&Lts&%02dOty%8eEYEnLz4yexQQLnL4MGU2JFn3OcmXcatBcabZgBdDdy67hdgW"
78  "tYn4");
79  for (size_t i = 0; i < iters; ++i) {
80  Uri u(s);
81  u.getQueryParams();
82  }
83 }
Definition: Uri.h:43
static set< string > s
int main ( int  argc,
char **  argv 
)

Definition at line 85 of file UriBenchmark.cpp.

References folly::init(), and folly::runBenchmarks().

85  {
86  folly::init(&argc, &argv);
88  return 0;
89 }
void runBenchmarks()
Definition: Benchmark.cpp:456
void init(int *argc, char ***argv, bool removeFlags)
Definition: Init.cpp:34
char ** argv