Skip to content
代码片段 群组 项目
未验证 提交 05cb8824 编辑于 作者: Kassio Borges's avatar Kassio Borges 提交者: GitLab
浏览文件

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
上级 6e22c21e
No related branches found
No related tags found
加载中
加载中
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册