gitlab-org--gitlab-foss/app/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.rb UI and copywriting improvements 2016-06-14 13:18:14 +02:00
awardable.rb Fix not normalized emoji paths 2016-07-14 08:51:00 +02:00
case_sensitivity.rb Revamp finding projects by namespaces 2015-10-08 14:35:32 +02:00
faster_cache_keys.rb Added concern for a faster "cache_key" method 2016-08-08 16:49:22 +02:00
importable.rb started refactoring some stuff based on MR feedback 2016-06-01 18:03:51 +02:00
internal_id.rb Use GitHub Issue/PR number as iid to keep references 2016-04-18 12:15:50 -03:00
issuable.rb Reduce number of queries made for merge_requests/:id/diffs 2016-07-28 16:52:19 +02:00
mentionable.rb Use cattr_accessor instead duplicating code on NoteOnDiff concern 2016-07-15 13:49:16 -03:00
milestoneish.rb Use a better message when milestone is newly created 2016-04-29 10:15:49 +01:00
note_on_diff.rb Add Discussion model to represent MR/diff discussion 2016-07-20 16:18:18 -06:00
participable.rb Use cattr_accessor instead duplicating code on NoteOnDiff concern 2016-07-15 13:49:16 -03:00
referable.rb Fix RangeError exceptions when referring to issues or merge requests outside of max database values 2016-06-18 13:07:38 -07:00
sortable.rb Sort by ID when sorting using "Recently created" 2016-01-07 14:53:02 +01:00
spammable.rb Refactor spam validation to a concern that can be easily reused and improve legibility in `SpamCheckService` 2016-07-26 19:29:16 -05:00
statuseable.rb Mark builds with manual actions as skipped 2016-07-18 14:48:36 +02:00
strip_attribute.rb Strip attributes for Milestone and Issuable. #3428 2015-11-26 10:16:50 -05:00
subscribable.rb Add API endpoints for un/subscribing from/to a label 2016-05-12 22:48:09 +02:00
taskable.rb Fix bug that happened when replacing the Task list. #2296 2015-11-20 13:58:45 -05:00
token_authenticatable.rb Enable Rubocop cops for invalid access modifiers 2016-07-19 15:12:15 +02:00