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

Add memory utilization to benchmark #813

Closed
Balearica opened this issue Aug 27, 2023 · 1 comment
Closed

Add memory utilization to benchmark #813

Balearica opened this issue Aug 27, 2023 · 1 comment

Comments

@Balearica
Copy link
Member

Tesseract.js has had multiple performance and memory-related bugs, which unfortunately are not flagged by automated testing. For performance-related bugs this was resolved by adding a benchmark in #628. We should expand this to also report memory usage so excessive memory use can be identified.

@Balearica
Copy link
Member Author

I added code to the browser speed benchmark to report memory usage both (1) after initializing the worker and (2) after running recognition. Notably, this will not tell us the peak memory usage during recognition, however it should flag any memory leaks or excessive memory use between jobs.

The number reported on my system (Chrome + Ubuntu) were 303.0 MB after initialization and 312.0 MB after recognition. This only includes the memory used in the single worker (not e.g. the main thread or the DOM). This seems high as it means just 3 worker will push memory usage >1GB during recognition, so hopefully we can figure out how to reduce for Tesseract.js v5.

The new(ish) function performance.measureUserAgentSpecificMemory is used to report memory usage. This allows for reporting the memory of both the main thread and workers, which unfortunately was not possible with performance.memory. Unfortunately, this requires specific server settings to work for security reasons, so it's possible somebody will encounter issues with different server configurations. I've edited the included server.js script so using npm run should work.

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