Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Commit

Permalink
Move performance readme to benchmarking folder
Browse files Browse the repository at this point in the history
  • Loading branch information
binarylogic committed Aug 21, 2016
1 parent ed340f8 commit f3030f1
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 28 deletions.
28 changes: 0 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,31 +63,3 @@ The IO format will write to anything that responds to the `#write` method.
# config/environments/production.rb (or staging, etc)
config.logger = Timber::Logger.new(Timber::LogDevices::IO.new(STDOUT)))
```

## Performance

Timber was designed with an obsessive focus on performance and resource usage. In the `/benchmark` folder you'll find benchmarking tests.

The following results were run on a bare metal server in order to achieve consistent and repeatable results.

```console
+---------------------------+------------+-----------------+------------------+
| Timber benchmarking. 10 requests per test. Times are "real" CPU time. |
+---------------------------+------------+-----------------+------------------+
| | Total | Per request avg | Per request diff |
+---------------------------+------------+-----------------+------------------+
| Control | 0.00568414 | 0.00056841 | |
| Timber probes only | 0.00673819 | 0.00067382 | 0.0001054 |
| Timber probes and logging | 0.00912786 | 0.00091279 | 0.00023897 |
+---------------------------+------------+-----------------+------------------+
```

1. `Control` - This is vanilla rails app without Timber installed.
2. `Timber probels only` - The same rails app but with the `Timber::Probes` installed, isolating probes performance.
3. `Timber probes and logging` - Testing the full Timber library, probes and adding context to each log line.

The benchmark can be run yourself via:

```console
$ appraisal ruby benchmark/rails_request.rb
```
27 changes: 27 additions & 0 deletions benchmark/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Benchmarking & Performance

Timber was designed with an obsessive focus on performance and resource usage. In the `/benchmark` folder you'll find benchmarking tests.

The following results were run on a bare metal server in order to achieve consistent and repeatable results.

```console
+---------------------------+------------+-----------------+------------------+
| Timber benchmarking. 10 requests per test. Times are "real" CPU time. |
+---------------------------+------------+-----------------+------------------+
| | Total | Per request avg | Per request diff |
+---------------------------+------------+-----------------+------------------+
| Control | 0.00568414 | 0.00056841 | |
| Timber probes only | 0.00673819 | 0.00067382 | 0.0001054 |
| Timber probes and logging | 0.00912786 | 0.00091279 | 0.00023897 |
+---------------------------+------------+-----------------+------------------+
```

1. `Control` - This is vanilla rails app without Timber installed.
2. `Timber probels only` - The same rails app but with the `Timber::Probes` installed, isolating probes performance.
3. `Timber probes and logging` - Testing the full Timber library, probes and adding context to each log line.

The benchmark can be run yourself via:

```console
$ appraisal ruby benchmark/rails_request.rb
```
13 changes: 13 additions & 0 deletions lib/timber/macros/deep_set.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module Timber
module Macros
module DeepSet
def set(hash, path, value)
keys = path.split(".")
target_hash = keys[0..-2].inject(hash) do |acc, key|
acc[key.to_sym] || raise("could not find key #{value.inspect} for #{hash}")
end
target_hash[keys.last] = value
end
end
end
end

0 comments on commit f3030f1

Please sign in to comment.