This repository has been archived by the owner on Dec 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move performance readme to benchmarking folder
- Loading branch information
1 parent
ed340f8
commit f3030f1
Showing
3 changed files
with
40 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |