Skip to content

High CPU and sluggishness running a simple wasm app #5073

Closed
@bogen85

Description

@bogen85

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

Example app when idling uses a lot of CPU.
When entering in text it feels sluggish.

With chromium running nothing, it is at very low CPU usage. See screenshots.
Just running https://get.webgl.org/?ref=colonist-blog around 14% and 8% (2 cores)
Just running the provided example code fyne serve --sourceDir client around 16 and 18% (2 cores)

Firefox shows similar results.
GPU acceleration is being used. See screenshots.

How to reproduce

fyne serve --sourceDir client with the provided example code in the directory client

Wait for app to load then look at CPU usage.

Type in text into the entry box and press enter (or press the button).

Screenshots

chromium idle
image

chromium just running https://get.webgl.org/?ref=colonist-blog
image

chromium just running the provided example fyne wasm app
image

GPU is being used
image

Chromium version 127
image

Example code

// client/main.go
package main

import (
        "fmt"
        "fyne.io/fyne/v2/app"
        "fyne.io/fyne/v2/container"
        "fyne.io/fyne/v2/widget"
)

func main() {
        a := app.NewWithID("go-fyne-wasm-app")
        w := a.NewWindow("Sample app")

        entry := widget.NewEntry()
        addButton := widget.NewButton("Add", func() {
                text := entry.Text
                if text != "" {
                        entry.SetText("")
                        fmt.Printf("Text: %s\n", text)
                }
        })

        entry.OnSubmitted = func(s string) {
                addButton.OnTapped()
        }

        w.SetContent(container.NewVBox(
                entry,
                addButton,
        ))

        w.ShowAndRun()
}

Fyne version

fyne version v2.5.0

Go compiler version

go version go1.23.0 linux/amd64

Operating system and version

AlmaLinux 9.4 x86_64

Additional Information

This might be related to #2803 but this is with an idling app.

chrome:://gpu shows:

*   WebGL: Hardware accelerated
*   WebGL2: Hardware accelerated

Metadata

Metadata

Assignees

No one assigned

    Labels

    unverifiedA bug that has been reported but not verified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions