Skip to content

Use `xpath` Nokogiri search for memory & cpu improvements

What does this MR do?

Explores possible improvement of BaseRelativeLinkFilter memory usage.

On my local env, on the example described here (massive note with links), I see a significant improvement:

  • 13 GB -> ~30 MB with :optimize_linkable_attributes disabled
  • 6.5 GB -> ~30 MB or less with :optimize_linkable_attributes enabled (it prevents for calling the heavy doc search twice)
  • It is faster in terms of CPU too on my experiment

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Rely on the existing specs, they are pretty extensive, from what I've seen.
Also, I run these queries manually in rails console on my HTML samples.

Security

N/A

Related to #329186

Edited by Aleksei Lipniagov

Merge request reports