cunarist / tokio-with-wasm

Mimicking tokio functionalies on web browsers
MIT License
31 stars 2 forks source link

[Question] Will `start_managing_pool` be called redundantly N times? #1

Closed Restioson closed 4 months ago

Restioson commented 4 months ago

From what I'm seeing here in spawn_blocking https://github.com/cunarist/tokio-with-wasm/blob/796872768ff76ac7d5f398395bb614e5c8c04493/src/tokio_wasm/task/mod.rs#L186-L200 It seems as though this start_managing_pool function https://github.com/cunarist/tokio-with-wasm/blob/796872768ff76ac7d5f398395bb614e5c8c04493/src/tokio_wasm/task/pool.rs#L303-L316

will be called as many times as spawn_blocking is, whereas from what I can see, only one should be needed.

Is this true or am I misunderstanding?

temeddix commented 4 months ago

Hi @Restioson , thanks for your insight :)

Yeah, it looks like that might cause excessive calls. The library does work because that's must a management function, but I do admit that it can cause slowdowns.

This should be fixed, though I'm a bit busy these days to do that. If anyone provides a PR, I will review it and publish a new version right away, though.

Also, may I ask you if you've experienced significant performance issues because of this?

temeddix commented 4 months ago

This should have been fixed now, thank you very much for your report :) Feel free to come back for any other discussions!

Restioson commented 4 months ago

Thanks so much for the quick fix :)