1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

24 commits

Author SHA1 Message Date
Richard Schneeman
dfbcfafd9a Move object allocation out of loop
Right now BenchmarkCleaner allocates hundreds of strings on every request with an exception. This patch moves those strings to be generated at boot once and re-used.

## Bench Methods

I took a modified form of CodeTriage https://github.com/schneems/codetriage-ko1-test-app/blob/master/perf.rake and ran given rake tasks with and without the patch to BacktraceCleaner.

I made an endpoint results in exception

```
  def index
    raise “foo"
  end
```

The gem `memory_profiler` was used to capture objects allocated for a single request. Then `benchmark/ips` was used to test the speed of the patch.

You will see that we use less objects and the code becomes measurably faster with this patch.

## With patch:

Memory for one request:

```
Total allocated 7441
Total retained 37
```

Requests per second:


```
Calculating -------------------------------------
                 ips         4 i/100ms
-------------------------------------------------
                 ips       43.0 (±4.7%) i/s -        216 in   5.037733s
```


## Without patch:

Memory used for one request:


```
Total allocated 11599
Total retained 35 
```

Requests per second:

```
Calculating -------------------------------------
                 ips         3 i/100ms
-------------------------------------------------
                 ips       39.4 (±7.6%) i/s -        198 in   5.052783s
```

## Analysis

The patch is faster:

```
(43.0 - 39.4 ) / 39.4 * 100
# => 9 # % ~ speed bump
```

It also allocates less objects:

```
11599 - 7441
# => 4158
```

These strings are allocated on __EVERY SINGLE REQUEST__. This patch saves us 4158 objects __PER REQUEST__ with exception.

Faster errors == Faster applications
2014-09-27 13:42:20 +08:00
Roman V. Babenko
e17cc4d493 Gem cont presence checking has been removed 2012-05-02 13:56:13 +03:00
Roman V. Babenko
d9e4dd1d66 Unnecessary uniqueness & force mapping has been removed at BacktraceCleaner#add_gem_filters 2012-04-03 01:58:40 +03:00
Rafael Mendonça França
0a5f3dedf4 Remove unneeded code 2012-01-06 22:52:02 -03:00
Xavier Noria
21ff8849bb in regexps, the dot in a character class is not a metacharacter 2010-10-15 16:31:00 +02:00
José Valim
8ae9b05fa0 Make backtrace_cleaner work as expected. Prior to this patch, the Full Trace rarely showed the full trace. Also, increase performance considerably. 2010-05-03 12:59:48 +02:00
Ryan Bigg
efa7e96821 It seems the test directory backtrace line is output with a / before it, thereby previously making it not match the regex. Support APP_DIRS that have backtrace lines maybe beginning with /. [#4277 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-05 23:50:12 +02:00
Carl Lerche
eea28b07cf Remove backtrace cleaner specific to Bundler. Bundler just uses Gem.dir and Gem.path now. 2010-02-11 10:29:50 -08:00
Joshua Peek
eb39d0f7b9 Use backtrace cleaner for dev mode exception page 2010-01-16 21:34:35 -06:00
Joshua Peek
fa1926ddaa Exclude gem backtrace filter if rubygems is not loaded 2009-10-20 09:32:26 -05:00
Carl Lerche
e1fdc8bba3 Remove config.gem in favor of using the bundler. This makes config/boot.rb obsolete.
The bundler library is at: http://github.com/wycats/bundler/ and is a rubygem.
2009-10-16 18:10:52 -07:00
Carl Lerche
2110a524a4 Deprecate RAILS_ROOT in favor of Rails.root (which proxies to the application's object root) 2009-10-16 12:51:02 -07:00
Joshua Peek
79a4d505fa Add gem filter for default gem path since it maybe different than the set of gem paths 2009-09-26 11:04:08 -05:00
Jeremy Kemper
acd5db300b Rejig active support dependencies to behave better with the boot process 2009-04-28 18:25:35 -07:00
Matt Jones
0da8e45baf Correctly clean backtraces from vendor/gems and gems in alternate install locations
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2009-03-09 12:49:58 +01:00
David Heinemeier Hansson
de540416e9 Make sure that Rails frameworks are silenced when running in gem mode too 2009-03-05 12:22:42 +01:00
Jeremy Kemper
a5004573d8 Only silence backtrace from plugin lib dirs 2008-12-30 18:25:44 -08:00
Jeremy Kemper
2f9edde142 Clean trailing / after rails root from backtraces 2008-12-30 12:44:31 -08:00
David Heinemeier Hansson
f9a02b12d1 Added gem backtrace pretty priting (Juan Lupión) [#1497 state:committed] 2008-12-15 15:37:27 +01:00
Joshua Peek
731dcd8404 Silence server backtrace in rescue templates and log files. Also remove some noise from missing template errors. 2008-12-05 11:24:28 -06:00
David Heinemeier Hansson
1e8f9634f6 Include Rack in the server noise 2008-11-29 10:45:52 +01:00
David Heinemeier Hansson
42b4407e35 Strip out the ./ part of the test path so the backtrace align perfectly 2008-11-24 15:43:47 +01:00
Manfred Stienstra
1f48c09094 Accept a prefix argument to filter_backtrace_with_cleaning [#1456 state:committed]
Add a prefix argument to filter_backtrace_with_cleaning so it has
the same arity as test/unit's filter_backtrace.

Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2008-11-24 11:35:55 +01:00
David Heinemeier Hansson
f42c77f927 Added ActiveSupport::BacktraceCleaner and Rails::BacktraceCleaner for cutting down on backtrace noise (inspired by the Thoughtbot Quiet Backtrace plugin) [DHH] 2008-11-22 18:06:08 +01:00