The changes include significant performance improvements for the GRU operator, which makes recognition of long text lines faster, as well as adapting the thread pool size to the number of physical rather than logical cores, reducing overhead on systems with SMT / hyperthreading.
To adapt to the thread pool changes, rten::thread_pool().run(...) is now used to run line recognition preprocessing in the same thread pool that is used to execute the recognition model. This avoids contention from having more threads than cores.
Benchmarks:
Testing with the polar-bears.png example on an Ice Lake Intel i5:
cargo build -r -p ocrs-cli
time target/release/ocrs ocrs-cli/test-data/polar-bears.png
Before: ~1.00s
After: ~570ms
In contrast with the why-rust.png example, which has a larger image but shorter lines, the impact is smaller:
The changes include significant performance improvements for the
GRU
operator, which makes recognition of long text lines faster, as well as adapting the thread pool size to the number of physical rather than logical cores, reducing overhead on systems with SMT / hyperthreading.To adapt to the thread pool changes,
rten::thread_pool().run(...)
is now used to run line recognition preprocessing in the same thread pool that is used to execute the recognition model. This avoids contention from having more threads than cores.Benchmarks:
Testing with the
polar-bears.png
example on an Ice Lake Intel i5:Before: ~1.00s After: ~570ms
In contrast with the
why-rust.png
example, which has a larger image but shorter lines, the impact is smaller:Before: ~916ms After: ~790ms