dankamongmen / notcurses

blingful character graphics/TUI library. definitely not curses.
https://nick-black.com/dankwiki/index.php/Notcurses
Other
3.43k stars 113 forks source link

Starting up a notcurses program takes a (short, but still) while #2697

Closed Spritetm closed 1 year ago

Spritetm commented 1 year ago

I'm writing a program using notcurses that I'd like to have start up instantly. Unfortunately, at the moment and with my hardware (a 5-year-old Core-I7 ULP), that is not what's happening: it takes about a second for notcurses_init() to finish. Profiling leads to the add_phi_and_eta_recurse call taking the majority of the time in this call; that seems to be part of the input escape code automaton.

I have no issue looking into this myself, but @dankamongmen , do you happen to have an ideas how this function can be optimized?

Spritetm commented 1 year ago

Okay, turns out a large factor is that some idiot added a bunch of fields with many numerical portions to the input automaton description (in https://github.com/dankamongmen/notcurses/pull/2696 ), and the input automaton needs to recurse a lot to resolve this. I think I have a solution, will push a PR for this.