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

New API: fast colors #81

Open
antonmedv opened this issue Apr 14, 2022 · 6 comments
Open

New API: fast colors #81

antonmedv opened this issue Apr 14, 2022 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@antonmedv
Copy link

Hi,

I'm building a new tool that requires a lot of Render calls (right now I prerender every line for a viewbox). The cpu profile shows lipgloss.Render func is taking lots of time:
Снимок экрана 2022-04-14 в 18 13 49

But I use only colors. Is it possible to add new methods, which allow to access only color functionality (no padding, borders, etc.)?

Thanks!

@meowgorithm
Copy link
Member

That's a great idea; we can totally optimize for that. Probably better than adding a new method would be for Render to simply short circuit if the style only contains ANSI sequences (colors, bold, underline, etc).

@meowgorithm meowgorithm added the enhancement New feature or request label Apr 14, 2022
@meowgorithm
Copy link
Member

This could be further optimized, but what about something roughly like this: d92e719? This will effectively exit the render early if there are only text colors and text styles to render.

@antonmedv
Copy link
Author

I can try check this branch.

@antonmedv
Copy link
Author

Seems better, but still:
Снимок экрана 2022-04-14 в 23 17 56

@meowgorithm
Copy link
Member

Yeah, it’s an improvement but we can do better. Have some ideas, will look into this some more.

@muesli
Copy link
Contributor

muesli commented Jun 2, 2022

If you really just need colors, you could of course try and see how you fare with directly using termenv here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants