Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test different optimization levels #42

Closed
Balearica opened this issue Aug 21, 2023 · 0 comments
Closed

Test different optimization levels #42

Balearica opened this issue Aug 21, 2023 · 0 comments

Comments

@Balearica
Copy link
Collaborator

The release version of Tesseract.js is compiled with the O3 optimization level. The size and runtime impact of compiling at different optimization levels is shown below. Size refers to the size of the tesseract-core-simd.wasm.js file. Runtime refers to the runtime using the Tesseract.js Node benchmark (found in the main repo here). Lower optimizations levels that are not generally used for release versions are not included.

Optimization Size Runtime
O2 4.7 MB 53s
O3 4.8 MB 51s
Os 3.6 MB 70s
Oz 3.6 MB 71s

As the O2 vs. O3 results are nearly identical, as are the Os vs. Oz results, the only question is whether to prefer the smaller/slower builds or larger/faster builds. While the lower sizes produced by Os and Oz are appealing, the cost is steep--a ~39% increase in runtime. For most uses, the runtime increase will outweigh the 1 MB increase in size, so the O3 level is used for the release version. However, using a different optimization level may be desirable for certain use cases where recognition speed is anticipated to be very low and/or network speeds are anticipated to be very slow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant