thoughtbot/paperclip — pull request #916 by phene (2012-06-16 00:29:37+00:00)
Title: Implemented performance improvement to interpolator

This patch introduces a performance improve and some small behavior changes to the interpolator.

Results of benchmarking have shown:
```ruby
[":class/:attachment/:style/:id/:filename", ":class/:id/:filename"].each do |path|
should "have performant path #{path}" do
ObjectSpace.garbage_collect
rebuild_model :path => path
@dummy = Dummy.new
@dummy.stubs(:id).returns(1024)
@file = File.new(fixture_file("5k.png"), 'rb')
@dummy.avatar = @file

puts (1..3).map { Benchmark.realtime { 1000.times { @dummy.avatar.path } } }
@file.close
end
end
```
```
Interpolate ":class/:attachment/:style/:id/:filename"
before
0.488147
0.488169
0.491802
after
0.326616
0.327032
0.305505

Interpolate ":class/:id/:filename"
before
0.366626
0.362184
0.361812
after
0.209302
0.184409
0.210002
```