Prevent processing markdown when copying notes
What does this MR do and why?
Skips processing markdown when copying notes if its content does not have references or uploads.
This is an attempt to increase performance when copying issues with too many notes.
To benchmark Notes::CopyService#execute
, I created a scenario on a test environment for an issue with 100 notes, half with
markdown references and the other half without any markdown and had the following results for 3 runs on each scenario:
- Before
user system total real
3.319781 0.036174 3.355955 ( 3.517167)
2.966824 0.031114 2.997938 ( 3.163734)
2.692113 0.015208 2.707321 ( 2.853069)
- After
user system total real
1.240000 0.023691 1.263691 ( 1.333012)
1.230946 0.011668 1.242614 ( 1.345406)
1.032660 0.036314 1.068974 ( 1.169220)
Even on a test environment with a clean database and a high end CPU it is possible to see significant performance improvement when skipping markdown processing for notes without any markdown.
One risk I can see with this approach is if new sensitive markdown is introduced on future releases
and we, for some reason, do not sanitize or redact its content on Notes::CopyService
.
related to #257809 (closed)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.