Extremely slow when invoking `engine.recognize_text` when in `debug` builds
ezkangaroo opened this issue · 2 comments
ezkangaroo commented
Rust version information:
rustc --version;
# rustc 1.83.0-nightly (f79a912d9 2024-09-18)
Steps to replicate:
; git clone https://github.com/robertknight/ocrs.git --depth 1
# following instruction from readme
; cd ocrs/ocrs/examples
; ./download-models.sh
; cargo run --example hello_ocr rust-book.jpg # note that we did not use --release
# takes roughly 2-3s on my m1 machine
robertknight commented
Did you mean 2-3 seconds or 20-30?
This is expected. You need to compile the rten
and rten-
prefixed dependencies with at least some optimizations enabled. The easiest way is to compile the whole project with --release
, but an alternative that won't affect your whole project is to enable optimizations for just those packages. See https://stackoverflow.com/a/60752451/434243.
ezkangaroo commented
Sweet - that makes sense; feel free to close this issue.