Skip to content

Adding tcell as a dependency delays startup time #764

Closed
@asturur

Description

@asturur

Hello everyone, i m working on a command line utility with optional UI.

I migrated a setup that included the c library curses to tview that uses tcell.
After finishing the migration i noticed that the application was considerably slower at starting up:

So i digged into what it could be and i made this test program:

package main

import (
    "github.com/gdamore/tcell/v2"
)

func main() {
    print("hello slow world")
    print(tcell.Color100)
}

this software compiled to run on a linux32 env with a slow 800mhz arm core

/media/fat/Scripts# time zaparoo.sh
hello slow world
real	0m0.576s
user	0m0.549s
sys	0m0.022s

while if i remove the tcell import i get the following:

/media/fat/Scripts# time zaparoo.sh
hello slow world
real	0m0.010s
user	0m0.006s
sys	0m0.006s

To be clear the start up times when i m running the real code of the service is around 0.014 so very similar to an empty program run.

Just importing tcell without displaying anything creates a decent delay.

So i wanted to ask if this is necessary and if it can be patched maybe adding an optional lazy initialization that i can run whenever i need to start using tcell actually rather than just including in my binary.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions