I still think the conclusion on "setTimeout is cursed"[0] is faulty:
> The setTimeout method in JavaScript is cursed when used with small values because the implementation may or may not actually wait the specified time.
The issue to me seems that performance.now()[1] returns the timestamp in milliseconds and will therefor round up/down. So 1ms errors are just within its tolerance.
[0]: https://github.com/immich-app/immich/pull/20655
[1]: https://developer.mozilla.org/en-US/docs/Web/API/Performance...