Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add benchmark README and latest numbers #689

Merged
merged 10 commits into from
Jan 24, 2020
51 changes: 51 additions & 0 deletions benchmark/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Benchmarks

## How to run

To run your benchmark, just:
```
$ npm run bench
```

If you're interested in writing benchmarking for other APIs, please write a benchmark in the `benchmark/index.js` module. Please refer to the `benchmark/tracer.js` or `benchmark/propagator.js` for more comprehensive examples.

## Results

# `0.3.3` release

```
Beginning BasicTracerRegistry Benchmark...
7 tests completed.

#startSpan x 79,704 ops/sec ±4.46% (10 runs sampled)
#startSpan:parent x 55,975 ops/sec ±1.90% (10 runs sampled)
#startSpan with attribute x 84,479 ops/sec ±2.82% (10 runs sampled)
#startSpan with 30 attributes x 36,239 ops/sec ±2.67% (10 runs sampled)
#startSpan with 100 attributes x 3,716 ops/sec ±1.92% (10 runs sampled)
#startSpan with SimpleSpanProcessor x 5,440 ops/sec ±39.90% (10 runs sampled)
#startSpan with BatchSpanProcessor x 2,284 ops/sec ±6.51% (10 runs sampled)

Beginning NodeTracerRegistry Benchmark...
7 tests completed.

#startSpan x 81,777 ops/sec ±4.32% (10 runs sampled)
#startSpan:parent x 57,455 ops/sec ±3.87% (10 runs sampled)
#startSpan with attribute x 85,139 ops/sec ±4.09% (10 runs sampled)
#startSpan with 30 attributes x 38,240 ops/sec ±1.95% (10 runs sampled)
#startSpan with 100 attributes x 3,670 ops/sec ±6.85% (10 runs sampled)
#startSpan with SimpleSpanProcessor x 4,504 ops/sec ±37.04% (10 runs sampled)
#startSpan with BatchSpanProcessor x 1,847 ops/sec ±5.26% (10 runs sampled)


Beginning B3Format Benchmark...
2 tests completed.

#Inject x 5,569,330 ops/sec ±1.44% (10 runs sampled)
#Extract x 4,882,488 ops/sec ±3.72% (10 runs sampled)

Beginning HttpTraceContext Benchmark...
2 tests completed.

#Inject x 13,423,892 ops/sec ±4.62% (10 runs sampled)
#Extract x 1,673,804 ops/sec ±2.29% (10 runs sampled)
```
3 changes: 2 additions & 1 deletion benchmark/tracer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const setups = [

for (const setup of setups) {
console.log(`Beginning ${setup.name} Benchmark...`);
const tracer = setup.registry.getTracer("benchmark");
const registry = setup.registry;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below line#59 depends on this.

const tracer = registry.getTracer("benchmark");
const suite = benchmark()
.add('#startSpan', function () {
const span = tracer.startSpan('op');
Expand Down