Skip to content

Performance of reset #158

@Glandos

Description

@Glandos

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.

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