fastfetch-cli / fastfetch

A maintained, feature-rich and performance oriented, neofetch like system information tool.
MIT License
11k stars 425 forks source link

Optimize Public IP Module #397

Closed Zerogiven closed 1 year ago

Zerogiven commented 1 year ago

Current state:

The request is the only thing which makes fastfetch slower than archey.

With public ip module (all have the same modules enabled)

❯ hyperfine --warmup 3  --runs 10 'neofetch' 'archey' 'fastfetch'
Benchmark 1: neofetch
  Time (mean ± σ):     614.9 ms ±  22.7 ms    [User: 203.2 ms, System: 110.5 ms]
  Range (min … max):   561.4 ms … 645.7 ms    10 runs

Benchmark 2: archey
  Time (mean ± σ):     160.6 ms ±  18.4 ms    [User: 96.2 ms, System: 29.3 ms]
  Range (min … max):   145.2 ms … 210.2 ms    10 runs

Benchmark 3: fastfetch
  Time (mean ± σ):     377.7 ms ± 551.4 ms    [User: 11.8 ms, System: 5.0 ms]
  Range (min … max):   198.2 ms … 1947.0 ms    10 runs

Summary
  'archey' ran
    2.35 ± 3.44 times faster than 'fastfetch'
    3.83 ± 0.46 times faster than 'neofetch'

And with no public ip module (only at fastfetch, others still have it enabled):

hyperfine --warmup 3  --runs 10 'neofetch' 'archey' 'fastfetch'
Benchmark 1: neofetch
  Time (mean ± σ):     610.1 ms ±  24.7 ms    [User: 213.2 ms, System: 100.0 ms]
  Range (min … max):   564.0 ms … 642.2 ms    10 runs

Benchmark 2: archey
  Time (mean ± σ):     153.4 ms ±   5.8 ms    [User: 100.4 ms, System: 22.5 ms]
  Range (min … max):   142.7 ms … 164.9 ms    10 runs

Benchmark 3: fastfetch
  Time (mean ± σ):      85.5 ms ±   3.6 ms    [User: 6.2 ms, System: 5.3 ms]
  Range (min … max):    81.4 ms …  92.5 ms    10 runs

Summary
  'fastfetch' ran
    1.80 ± 0.10 times faster than 'archey'
    7.14 ± 0.42 times faster than 'neofetch'

Wanted state:

I want that the first benchmark as fast as the second :-D

Why the change is sensible:

Time is money ;-) no, but if you have such a tool starting at .bashrc, every millisecond counts ;-)

CarterLi commented 1 year ago

Try --public-ip-url v4.ident.me and make sure PublicIP is the last module to print

Zerogiven commented 1 year ago

The other public IP provider did the trick...

Default:

❯ hyperfine --warmup 3  --runs 10 'neofetch' 'archey' 'fastfetch --structure Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Display:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:GPU:Memory:Disk:Battery:PowerAdapter:Locale:Break:Colors:PublicIP'
Benchmark 1: neofetch
  Time (mean ± σ):     540.7 ms ±  19.1 ms    [User: 162.5 ms, System: 92.6 ms]
  Range (min … max):   507.4 ms … 571.1 ms    10 runs

Benchmark 2: archey
  Time (mean ± σ):     185.6 ms ±  15.6 ms    [User: 120.0 ms, System: 40.0 ms]
  Range (min … max):   163.4 ms … 219.7 ms    10 runs

Benchmark 3: fastfetch --structure Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Display:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:GPU:Memory:Disk:Battery:PowerAdapter:Locale:Break:Colors:PublicIP
  Time (mean ± σ):     204.2 ms ±   2.2 ms    [User: 17.2 ms, System: 14.2 ms]
  Range (min … max):   200.1 ms … 208.5 ms    10 runs

Summary
  'archey' ran
    1.10 ± 0.09 times faster than 'fastfetch --structure Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Display:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:GPU:Memory:Disk:Battery:PowerAdapter:Locale:Break:Colors:PublicIP'
    2.91 ± 0.27 times faster than 'neofetch'

With public ip url param:

❯ hyperfine --warmup 3  --runs 10 'neofetch' 'archey' 'fastfetch --structure Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Display:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:GPU:Memory:Disk:Battery:PowerAdapter:Locale:Break:Colors:PublicIP --public-ip-url v4.ident.me'
Benchmark 1: neofetch
  Time (mean ± σ):     539.2 ms ±  21.4 ms    [User: 157.8 ms, System: 98.6 ms]
  Range (min … max):   510.2 ms … 574.1 ms    10 runs

Benchmark 2: archey
  Time (mean ± σ):     177.3 ms ±  13.0 ms    [User: 109.9 ms, System: 40.4 ms]
  Range (min … max):   152.9 ms … 192.9 ms    10 runs

Benchmark 3: fastfetch --structure Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Display:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:GPU:Memory:Disk:Battery:PowerAdapter:Locale:Break:Colors:PublicIP --public-ip-url v4.ident.me
  Time (mean ± σ):      96.4 ms ±   3.8 ms    [User: 10.6 ms, System: 10.9 ms]
  Range (min … max):    92.3 ms … 102.9 ms    10 runs

Summary
  'fastfetch --structure Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Display:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:GPU:Memory:Disk:Battery:PowerAdapter:Locale:Break:Colors:PublicIP --public-ip-url v4.ident.me' ran
    1.84 ± 0.15 times faster than 'archey'
    5.59 ± 0.31 times faster than 'neofetch'

Sorry i overlooked at the --public-ip-url param :+1: