btpf / Alexandria

A minimalistic cross-platform eBook reader built with Tauri, Epub.js, and Typescript
GNU General Public License v3.0
2.15k stars 50 forks source link

Use tokio current_thread runtime? #9

Closed leshow closed 10 months ago

leshow commented 1 year ago

src-tauri looks like it uses the default multi-threaded tokio runtime, this will spawn one OS thread per core. On my machine that means 16 threads. The current_thread scheduler, uses only one OS thread and tokio tasks are scheduled concurrently on it and is probably all this project needs?

This is a one line change, you can swap #[tokio::main] for #[tokio::main(flavor = "current_thread")]

Totally unrelated, I'm not familiar with tauri but a quick blurb somewhere on how to get it the project running from src might be nice.

The rust src throws off a bunch of clippy warnings. I'm happy to do a little cleanup if you want.

btpf commented 1 year ago

You are absolutely welcome to clean up those warnings and fix the scheduler. Submit a PR and ill look it over.

I have also just written the build instructions. Tell me if you run into any difficulties.

Thanks for helping!

https://github.com/btpf/Alexandria/blob/main/docs/Build%20Instructions.md

btpf commented 10 months ago

Hey @leshow, I added the change you suggested. Thanks again, would have never seen this otherwise!