gitlab-org--gitlab-foss/spec/models/concerns
Yorick Peterse 77c8520e2e
Added concern for a faster "cache_key" method
This concern provides an optimized/simplified version of the "cache_key"
method. This method is about 9 times faster than the default "cache_key"
method.

The produced cache keys _are_ different from the previous ones but this
is worth the performance improvement. To showcase this I set up a
benchmark (using benchmark-ips) that compares FasterCacheKeys#cache_key
with the regular cache_key. The output of this benchmark was:

    Calculating -------------------------------------
               cache_key     4.825k i/100ms
          cache_key_fast    21.723k i/100ms
    -------------------------------------------------
               cache_key     59.422k (± 7.2%) i/s -    299.150k
          cache_key_fast    543.243k (± 9.2%) i/s -      2.694M

    Comparison:
          cache_key_fast:   543243.4 i/s
               cache_key:    59422.0 i/s - 9.14x slower

To see the impact on real code I applied these changes and benchmarked
Issue#referenced_merge_requests. For an issue referencing 10 merge
requests these changes shaved off between 40 and 60 milliseconds.
2016-08-08 16:49:22 +02:00
..
access_requestable_spec.rb Exclude requesters from Project#members, Group#members and User#members 2016-07-01 17:44:46 +02:00
awardable_spec.rb Fix rubocop offense in awardable specs 2016-06-06 07:42:12 +02:00
case_sensitivity_spec.rb trick rubocop and temporarily add ruby 2.1 images for any branch 2016-01-28 11:41:58 +01:00
faster_cache_keys_spec.rb Added concern for a faster "cache_key" method 2016-08-08 16:49:22 +02:00
issuable_spec.rb Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
mentionable_spec.rb Method for returning issues readable by a user 2016-07-29 12:51:18 +02:00
milestoneish_spec.rb Project members with guest role can't access confidential issues 2016-06-13 19:32:00 -03:00
participable_spec.rb Cache Participable#participants in instance variable 2016-06-21 12:54:12 +02:00
statuseable_spec.rb Render canceled status if any of the jobs canceled 2016-04-27 14:16:01 +02:00
strip_attribute_spec.rb Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
subscribable_spec.rb Add API endpoints for un/subscribing from/to a label 2016-05-12 22:48:09 +02:00
token_authenticatable_spec.rb Enable RSpec/NotToNot cop and auto-correct offenses 2016-05-24 15:40:29 -04:00