Code Monkey home page Code Monkey logo

Comments (10)

pchampio avatar pchampio commented on May 10, 2024

google/flutter-desktop-embedding#58

from go-flutter.

zet4 avatar zet4 commented on May 10, 2024

So I finally got google/fde to build and run on my windows machine and the performance / resource usage was a lot lower than what I saw with Go bindings here, so it's not completely on Flutter here, is there anything we can do to figure out what's causing the constant 15% on idle?

from go-flutter.

pchampio avatar pchampio commented on May 10, 2024

On which platform are you running ?

from go-flutter.

zet4 avatar zet4 commented on May 10, 2024

Both of the embedders were tested on Windows 10 x64. With go version go1.11rc1, which is a bit behind, but not enough to cause any drastic changes, the sample builds in gh releases were showing the same results anyway.

from go-flutter.

pchampio avatar pchampio commented on May 10, 2024

Using glfw.PollEvents() in gutter.go is way more CPU intensive than using glfw.WaitEvents().
If you want the embedder to receive a platform plugin message from the flutter side. The line flutter.EngineFlushPendingTasksNow() has to be run (flutter#16912).

When using glfw.PollEvents() the line flutter.EngineFlushPendingTasksNow() is always called (infinite loop). If we use glfw.WaitEvents() (The best solution to improve the resource usage ) there has to be a new frame to be rendered to notify the embedder of a new platform message.

I'm using glfw.PollEvents() for the demo because in some edge cases the platform message was not received by the embedder, making the keyboard plugin fail.

from go-flutter.

pchampio avatar pchampio commented on May 10, 2024

The Windows version of flutter-desktop-embedding seems to be using glfwWaitEvents

from go-flutter.

zet4 avatar zet4 commented on May 10, 2024

Alright awesome, after switching to WaitEvents the CPU usage has become tolerable for my use case.
As you mentioned using this method has its drawbacks too, keyboard plugin in particular, even though I've yet to notice said edge cases from my short testing, but since my project will likely not require much keyboard input, I will hope it's going to be okay for me.

I am assuming nothing else can really be done about this until 16912 is resolved.

from go-flutter.

thetooth avatar thetooth commented on May 10, 2024

Just bumping this as I am experiencing similar issues. Are you saying 15% total CPU or single core utilization? Because I am getting 100% single thread utilization that is locked to one core (with the same environment using the simple demo example).

Unfortunately trying to use this in an embedded setting(Intel NUC) won't end well 🌶️ 🌶️ 🌶️

I have tried switching to WaitEvents and this completely solves the issue, I am also not seeing the edge case mentioned.

from go-flutter.

GeertJohan avatar GeertJohan commented on May 10, 2024

I have included a change in #86 that should improve this issue by limiting the message loop to ~60fps iterations.

from go-flutter.

GeertJohan avatar GeertJohan commented on May 10, 2024

#86 has been merged.The performence is not yet 100% efficient, but seems to be the best we can do with the currently available features from engine/embedder. It's certainly not "poor performance" anymore, so I'm closing this issue.

from go-flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.