Skip to content

Improved timeago performance

Phil Hughes requested to merge timeago-perf into master

What does this MR do?

  • Reduces the number of timeouts for timeago elements to 1, rather than 1 per element

The timeout loops through all timeago elements & then renders the formatted text. Turbolinks also clears this timeout on each load, instead of zombie timeouts sticking around.

  • Caches the timeago instance & then re-uses that rather than creating a new instance every for every element

Caches the timeago instance into a variable which is then used. Previously everytime getTimeago was called it would create a new timeago instance, which would never be re-used or deleted.

What are the relevant issue numbers?

Closes #25728 (closed)

Merge request reports