GNU bug report logs -
#71573
[PATCH] seconds-to-string-approximate
Previous Next
Reported by: JD Smith <jdtsmith <at> gmail.com>
Date: Sat, 15 Jun 2024 17:25:02 UTC
Severity: wishlist
Tags: patch
Merged with 71572
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Adam Porter <adam <at> alphapapa.net> writes:
> ;; See also the built-in function `format-seconds', which I seem to have
> ;; overlooked before writing this. However, a quick benchmark, run
> ;; 100,000 times, shows that, when controllable formatting is not needed,
> ;; `ts-human-format-duration' is much faster and generates less garbage:
>
> ;; | Form | x faster than next | Total runtime | #
> of GCs | Total GC runtime |
> ;;
> |--------------------------+--------------------+---------------+----------+------------------|
> ;; | ts-human-format-duration | 5.82 | 0.832945 |
> 3 | 0.574929 |
> ;; | format-seconds | slowest | 4.848253 |
> 17 | 3.288799 |
Is this used a lot in hot loops? IOW, is it worth optimizing?
If yes, how about adding something like what you have as an optimization
to `format-seconds` for when the format is very simple? Would that
remove the need for `ts-human-format-duration'?
This bug report was last modified 208 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.