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

High CPU use on example #5

Open
capocasa opened this issue Dec 10, 2024 · 3 comments
Open

High CPU use on example #5

capocasa opened this issue Dec 10, 2024 · 3 comments

Comments

@capocasa
Copy link

Hello! I just tried your cool GUI library!!! I found it a joy to use.

One thing I noticed, the example seems to be using about 50% of a CPU core.

I don't mean to push to get a fix, I just noticed this and it's good to document it!

I was looking into doing a GLFM port but I might need to use a retained mode GUI as Dear Imgui also uses about 5% which is a bit stiff for a nongame phone app.

Thanks for making koi!

@johnnovak
Copy link
Owner

johnnovak commented Dec 10, 2024

Hello! I just tried your cool GUI library!!! I found it a joy to use.

One thing I noticed, the example seems to be using about 50% of a CPU core.

I don't mean to push to get a fix, I just noticed this and it's good to document it!

I was looking into doing a GLFM port but I might need to use a retained mode GUI as Dear Imgui also uses about 5% which is a bit stiff for a nongame phone app.

Thanks for making koi!

Hi, thanks, glad you like it.

Yeah that CPU usage is normal. Modern desktop CPUs have 12-24 cores these days, so who cares 😄 For resource-constrainted devices, you might want something else, but then people use NanoVG for all kinds of phone apps and those must have similar CPU usages.

Dear Imgui is super light because it doesn't use vector graphics. NanoVG rasterizes the vector graphics on the CPU, so this is expected.

@zacharycarter
Copy link

zacharycarter commented Jan 28, 2025

@johnnovak NanoVG has some inherent performance issues that some folks have documented and even built alternatives to address.

https://programmer.group/nanovg-optimized-notes-the-secret-of-five-fold-performance-improvement.html

https://github.com/jdryg/vg-renderer

So yes, I believe you are correct that the high CPU usage is normal for NanoVG, but NanoVG's implementation leaves some things to be desired in the performance arena as well.

Having said all of that - the library looks very nice! I really wish it wasn't tightly coupled with any framework, but I imagine that made the implementation a bit more straightforward.

Anywho, I just wanted to share these links in case you were interested in them.

@johnnovak
Copy link
Owner

Having said all of that - the library looks very nice! I really wish it wasn't tightly coupled with any framework, but I imagine that made the implementation a bit more straightforward.

It will be probably completely decoupled in the future and it will only generate a list of draw calls. I want to use koi with blend2d in some other project (oh, and I'll need a C API too, so that will be added as well).

Anywho, I just wanted to share these links in case you were interested in them.

Cheers, I was aware of these and I get what you're saying (these issues are "normal" for NanoVg... but there are better ways, sure).

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

3 participants