Skip to content

Cached binary detection [RUN ALL RSPEC] [RUN AS-IF-FOSS]

Robert May requested to merge cached-encoding-detection into master

What does this MR do?

Caches the results of a CPU-intensive method used in the diff rendering process. On my local machine this is on average about 1-10x faster on subsequent loads, depending on the size of the files.

Related https://gitlab.com/gitlab-org/gitlab/-/issues/326316

Related #322559 (closed)

Benchmarks

Uncached

Benchmark:   0.004205   0.000026   0.004231 (  0.003924)
Benchmark:   0.004208   0.000026   0.004234 (  0.004005)
Benchmark:   0.004899   0.000130   0.005029 (  0.005030)
Benchmark:   0.000198   0.000030   0.000228 (  0.000226)
Benchmark:   0.004787   0.000114   0.004901 (  0.004932)
Benchmark:   0.000247   0.000000   0.000247 (  0.000247)
Benchmark:   0.001998   0.000000   0.001998 (  0.002055)
Benchmark:   0.001881   0.000000   0.001881 (  0.001932)
Benchmark:   0.001451   0.000000   0.001451 (  0.001512)
Benchmark:   0.000161   0.000000   0.000161 (  0.000161)
Benchmark:   0.000530   0.000000   0.000530 (  0.000589)
Benchmark:   0.000151   0.000000   0.000151 (  0.000151)
Benchmark:   0.001632   0.000000   0.001632 (  0.001686)
Benchmark:   0.001426   0.000000   0.001426 (  0.001487)
Benchmark:   0.000571   0.000000   0.000571 (  0.000633)
Benchmark:   0.000171   0.000000   0.000171 (  0.000171)
Benchmark:   0.002252   0.000000   0.002252 (  0.002324)
Benchmark:   0.000174   0.000000   0.000174 (  0.000174)
Benchmark:   0.002398   0.000000   0.002398 (  0.002459)
Benchmark:   0.002396   0.000000   0.002396 (  0.002470)
Benchmark:   0.001046   0.000000   0.001046 (  0.001104)
Benchmark:   0.001041   0.000000   0.001041 (  0.001107)
Benchmark:   0.000545   0.000000   0.000545 (  0.000604)
Benchmark:   0.000523   0.000000   0.000523 (  0.000580)
Benchmark:   0.001447   0.000000   0.001447 (  0.001450)
Benchmark:   0.001127   0.000000   0.001127 (  0.001154)
Benchmark:   0.000842   0.000000   0.000842 (  0.000895)
Benchmark:   0.000762   0.000000   0.000762 (  0.000825)
Benchmark:   0.001118   0.000000   0.001118 (  0.001186)
Benchmark:   0.001112   0.000000   0.001112 (  0.001181)
Benchmark:   0.001694   0.000000   0.001694 (  0.001749)
Benchmark:   0.001616   0.000000   0.001616 (  0.001681)
Benchmark:   0.000949   0.000000   0.000949 (  0.001002)
Benchmark:   0.000156   0.000000   0.000156 (  0.000156)
Benchmark:   0.004807   0.000000   0.004807 (  0.004835)
Benchmark:   0.004783   0.000000   0.004783 (  0.004819)
Benchmark:   0.004634   0.000000   0.004634 (  0.004704)
Benchmark:   0.004593   0.000000   0.004593 (  0.004659)
Benchmark:   0.002099   0.000000   0.002099 (  0.002131)
Benchmark:   0.002058   0.000000   0.002058 (  0.002089)
Benchmark:   0.001406   0.000000   0.001406 (  0.001466)
Benchmark:   0.000158   0.000000   0.000158 (  0.000158)
Benchmark:   0.001187   0.000000   0.001187 (  0.001244)
Benchmark:   0.001264   0.000000   0.001264 (  0.001295)
Benchmark:   0.002565   0.000000   0.002565 (  0.002624)
Benchmark:   0.002596   0.000000   0.002596 (  0.002625)

Cached

Benchmark:   0.008437   0.000053   0.008490 (  0.008119)
Benchmark:   0.000326   0.000052   0.000378 (  0.000345)
Benchmark:   0.000237   0.000038   0.000275 (  0.000275)
Benchmark:   0.000176   0.000000   0.000176 (  0.000175)
Benchmark:   0.000278   0.000000   0.000278 (  0.000277)
Benchmark:   0.000255   0.000000   0.000255 (  0.000255)
Benchmark:   0.000323   0.000000   0.000323 (  0.000323)
Benchmark:   0.000344   0.000000   0.000344 (  0.000361)
Benchmark:   0.000279   0.000000   0.000279 (  0.000285)
Benchmark:   0.000239   0.000000   0.000239 (  0.000238)
Benchmark:   0.000417   0.000000   0.000417 (  0.000417)
Benchmark:   0.000162   0.000000   0.000162 (  0.000162)
Benchmark:   0.000357   0.000000   0.000357 (  0.000383)
Benchmark:   0.000370   0.000000   0.000370 (  0.000370)
Benchmark:   0.000272   0.000000   0.000272 (  0.000299)
Benchmark:   0.000159   0.000000   0.000159 (  0.000159)
Benchmark:   0.000513   0.000000   0.000513 (  0.000517)
Benchmark:   0.000226   0.000000   0.000226 (  0.000226)
Benchmark:   0.000271   0.000000   0.000271 (  0.000272)
Benchmark:   0.000377   0.000000   0.000377 (  0.000379)
Benchmark:   0.000379   0.000000   0.000379 (  0.000379)
Benchmark:   0.000286   0.000000   0.000286 (  0.000286)
Benchmark:   0.000415   0.000000   0.000415 (  0.000416)
Benchmark:   0.000534   0.000000   0.000534 (  0.000534)
Benchmark:   0.000285   0.000000   0.000285 (  0.000307)
Benchmark:   0.000401   0.000000   0.000401 (  0.000402)
Benchmark:   0.000367   0.000000   0.000367 (  0.000367)
Benchmark:   0.000279   0.000000   0.000279 (  0.000279)
Benchmark:   0.000282   0.000000   0.000282 (  0.000282)
Benchmark:   0.000270   0.000000   0.000270 (  0.000269)
Benchmark:   0.000265   0.000000   0.000265 (  0.000266)
Benchmark:   0.000267   0.000000   0.000267 (  0.000288)
Benchmark:   0.000283   0.000000   0.000283 (  0.000297)
Benchmark:   0.000221   0.000000   0.000221 (  0.000221)
Benchmark:   0.000269   0.000000   0.000269 (  0.000270)
Benchmark:   0.000376   0.000000   0.000376 (  0.000376)
Benchmark:   0.000430   0.000000   0.000430 (  0.000429)
Benchmark:   0.000281   0.000000   0.000281 (  0.000280)
Benchmark:   0.000342   0.000000   0.000342 (  0.000342)
Benchmark:   0.000451   0.000000   0.000451 (  0.000451)
Benchmark:   0.000265   0.000000   0.000265 (  0.000265)
Benchmark:   0.000242   0.000000   0.000242 (  0.000222)
Benchmark:   0.000358   0.000000   0.000358 (  0.000358)
Benchmark:   0.000478   0.000000   0.000478 (  0.000477)
Benchmark:   0.000408   0.000000   0.000408 (  0.000483)
Benchmark:   0.000304   0.000000   0.000304 (  0.000307)

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Robert May

Merge request reports

Loading