Skip to content

Draft: Use object.freeze on diff lines to save memory

Phil Hughes requested to merge ph/333887/objectFreezeLineConstants into master

What does this MR do?

To help improve the memory in the diffs app we are now freezing some diff line with Object.freeze. Doing this signals to Vue that this data won't be changing so Vue won't add any getters/setters/watchers to this data.

To achieve this I have created a new property called constants that will hold this frozen data, hopefully this will ease any mis-understanding why certain properties don't trigger re-renders.

Improvement wise - I have been seeing a small improvement, 3% reduction in memory, locally on a relatively small merge request.

Closes #333887 (closed)

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • 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

Merge request reports