rems icon indicating copy to clipboard operation
rems copied to clipboard

Faster translations

Open aatkin opened this issue 1 year ago • 0 comments

Internal performance update to how translations are fetched.

Motivation

Email template transformations take quite a bit of time when large-ish number of emails are produced. For example application.event/decided creates 1 email for each workflow handler:

event-to-emails, disabled cache

handler count mean lower-q 2.5% upper-q 97.5%
1 4,780888 ms 4,097078 ms 6,170799 ms
10 52,443133 ms 49,652797 ms 55,356244 ms
50 223,241818 ms 203,445667 ms 249,808264 ms
100 441,938544 ms 413,564604 ms 478,001015 ms
200 834,458932 ms 804,961543 ms 914,037245 ms

(using 2019 Macbook Pro with 2,3 GHz 8-Core Intel Core i9)

Screenshot 2024-05-15 at 17 22 06

Caching dictionary for tempura function reduces mean time by almost 100x. For same event, but using cached translation function:

event-to-emails, cache

handler count mean lower-q 2.5% upper-q 97.5% cache size
1 40,996545 µs 39,542207 µs 43,635827 µs 882,5 KiB
10 397,217641 µs 367,224108 µs 435,834954 µs 882,5 KiB
50 2,158321 ms 1,904828 ms 2,440271 ms 882,5 KiB
100 4,206048 ms 3,757476 ms 4,956851 ms 882,5 KiB
200 8,656116 ms 7,626819 ms 10,665969 ms 882,5 KiB

Screenshot 2024-05-15 at 16 26 41

Checklist for author

Remove items that aren't applicable, check items that are done.

Reviewability

  • [ ] Link to issue (no issue number)
  • [x] Consider adding screenshots for ease of review (clj-async-profiler)

Documentation

  • [ ] Update changelog if necessary

Testing

  • [x] Complex logic is unit tested
  • [x] Valuable features are integration / browser / acceptance tested automatically

Follow-up

  • [ ] New tasks are created for pending or remaining tasks

aatkin avatar May 15 '24 14:05 aatkin