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

Performance of reset #158

Closed
1 task done
Glandos opened this issue Jul 28, 2023 · 1 comment
Closed
1 task done

Performance of reset #158

Glandos opened this issue Jul 28, 2023 · 1 comment

Comments

@Glandos
Copy link

Glandos commented Jul 28, 2023

Describe the bug

Since #101 the reset variable in neofetch was changed to \e[39;22m, to only reset colors.
When drawing colored bars, performance dropped drastically. On my system, it has dropped from 253ms to 1.1s.

  • Does this issue still occur in the master branch? (Required)

Expected behavior

Performance should not drop drastically when resetting colors.

Screenshots

With actual reset variable

~ ⏰6s574ms❯ /tmp/hyfetch/bin/neowofetch
10.35.203.168 user@poulpe 
─────────────────────────── 
OS > Debian GNU/Linux trixie/sid 🐧 > 6.3.0-1-amd64 
Uptime > 2 days, 21 hours, 49 mins 
Server > Latitude 5590 Intel i7-8650U (8) @ 4.2GHz 
Memory > [🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋] 17.43 GiB / 31.20 GiB (55%) 
/ > [🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋] 170G / 459G (40%) 
/mnt/public > [🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋] 940G / 1.7T (57%) 
 
~ ❯ hyperfine /tmp/hyfetch/bin/neowofetch
Benchmark 1: /tmp/hyfetch/bin/neowofetch
  Time (mean ± σ):      1.137 s ±  0.046 s    [User: 1.066 s, System: 0.074 s]
  Range (min … max):    1.086 s …  1.224 s    10 runs
 

With reset variable set to \e[0m:

~ ⏰11s434ms❯ /tmp/hyfetch/bin/neowofetch
10.35.203.168 user@poulpe 
─────────────────────────── 
OS > Debian GNU/Linux trixie/sid 🐧 > 6.3.0-1-amd64 
Uptime > 2 days, 21 hours, 49 mins 
Server > Latitude 5590 Intel i7-8650U (8) @ 4.2GHz 
Memory > [🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋] 17.43 GiB / 31.20 GiB (55%) 
/ > [🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋] 170G / 459G (40%) 
/mnt/public > [🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋🬋] 940G / 1.7T (57%) 

~ ❯ hyperfine /tmp/hyfetch/bin/neowofetch
Benchmark 1: /tmp/hyfetch/bin/neowofetch
  Time (mean ± σ):     253.9 ms ±  10.5 ms    [User: 181.3 ms, System: 76.3 ms]
  Range (min … max):   241.3 ms … 272.7 ms    10 runs

Config file

N/A

Additional context

I'm using Tilix on Xfce.
bars_border="on" trigger the bug, since it calls $(color fg) which itself prints ${reset} using printf. Setting bars_border="off" is a small workaround, but to get full performance, \e[0m is the best choice.

@hykilpikonna
Copy link
Owner

image

image

I'm also getting consistent result that using \e[0m is faster.

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

No branches or pull requests

2 participants