Avoid creating Gitlab::Graphql::Authorize::FieldExtension::Redactor
With the goal to reduce the number of objects created during a GraphQL call, the condition to initialize a `Gitlab::Graphql::Authorize::FieldExtension::Redactor`, the `Gitlab::Graphql::Authorize::FieldExtension::Redactor#active?` was extracted to the `Gitlab::Graphql::Authorize::FieldExtension#authorized?`. Local benchmark comparisons: * ips (iterations per second) ``` Warming up -------------------------------------- master 1.000 i/100ms avoid_redact 1.000 i/100ms Calculating ------------------------------------- master 0.324 (± 0.0%) i/s (3.08 s/i) - 4.000 in 12.343343s avoid_redact 0.326 (± 0.0%) i/s (3.07 s/i) - 4.000 in 12.277845s Comparison: avoid_redact: 0.3 i/s master: 0.3 i/s - 1.01x slower ``` * memory comsumption ``` Calculating ------------------------------------- master 570.367M memsize ( 807.319k retained) 3.385M objects ( 2.032k retained) 50.000 strings ( 50.000 retained) avoid_redact 569.443M memsize ( 617.745k retained) 3.380M objects ( 1.319k retained) 50.000 strings ( 50.000 retained) Comparison: avoid_redact: 569442619 allocated master: 570366893 allocated - 1.00x more ``` Related to: https://gitlab.com/gitlab-org/gitlab/-/issues/521588
加载中
想要评论请 注册 或 登录