diff options
author | 2024-02-29 14:11:46 +0100 | |
---|---|---|
committer | 2024-02-29 19:24:15 -0800 | |
commit | ab85d4d6788e6b6e01ad785db74d386dfc23d039 (patch) | |
tree | da334e83eefb6b26fe4ffb2362e09534c7fbd7c7 /internal/ui/static/js/keyboard_handler.js | |
parent | 31ac62f410361d9c6b1f27c36c2ff8cd8309653a (diff) | |
download | v2-ab85d4d6788e6b6e01ad785db74d386dfc23d039.tar.gz v2-ab85d4d6788e6b6e01ad785db74d386dfc23d039.tar.zst v2-ab85d4d6788e6b6e01ad785db74d386dfc23d039.zip |
Improve EstimateReadingTime's speed by a factor 7
- Refactorise the tests and add some
- Use 250 signs instead of the whole text
- Only check for Korean, Chinese and Japanese script
- Add a benchmark
- Use a more idiomatic control flow
```console
$ # main branch
$ go test -bench=.
goos: linux
goarch: amd64
pkg: miniflux.app/v2/internal/reader/readingtime
BenchmarkEstimateReadingTime-12 267 4821268 ns/op
PASS
ok miniflux.app/v2/internal/reader/readingtime 1.754s
$ # speed_up_reading_time branch
$ go test -bench=.
goos: linux
goarch: amd64
pkg: miniflux.app/v2/internal/reader/readingtime
cpu: 12th Gen Intel(R) Core(TM) i7-1265U
BenchmarkEstimateReadingTime-12 1941 653312 ns/op
PASS
ok miniflux.app/v2/internal/reader/readingtime 1.342s
$
```
Diffstat (limited to 'internal/ui/static/js/keyboard_handler.js')
0 files changed, 0 insertions, 0 deletions