Skip to content

Performance improvement on Projects::BuildsController#show.html

What does this MR do?

This is performance improvement on Project::BuildsController#show.html by removing unused code.

Are there points in the code the reviewer needs to double check?

log_state (data-log-state) shouldn't be provided in HTML view as it is only required in the JSON response.

Why was this MR needed?

This skipping to call Ansi2html can resolve the GitLab instance being in stuck when a user opens a build page which has a larger (100kB, 1MB or more) trace as Ansi2html is slow (#27724 (closed)).

Results

70% performance improvement is confirmed in development on my computer as follows:

as is

(repeated 3 times)

  Rendered projects/builds/show.html.haml within layouts/project (2599.6ms)
  Rendered projects/builds/show.html.haml within layouts/project (2277.3ms)
  Rendered projects/builds/show.html.haml within layouts/project (2109.7ms)

to be

(repeated 3 times)

  Rendered projects/builds/show.html.haml within layouts/project (913.5ms)
  Rendered projects/builds/show.html.haml within layouts/project (564.8ms)
  Rendered projects/builds/show.html.haml within layouts/project (611.5ms)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #28019 (closed)

Merge request reports