powerlevel9k icon indicating copy to clipboard operation
powerlevel9k copied to clipboard

[Performance] PL9K is terribly slow

Open Martmists-GH opened this issue 5 years ago • 2 comments

Your Hardware

512GB PCIe NVMe Three Layer Cell SSD

Virtualization

Native Linux (Arch x86_64)

Terminal

Termite (latest)

How Fast is Fast

********************************************************************
                      Prompt Benchmark Results
********************************************************************
Warmup duration      8s
Benchmark duration   5.442s
Benchmarked prompts  1
Time per prompt      5442.32ms  <-- prompt latency (lower is better)
********************************************************************

Root cause seems to be the battery prompt. Settings:

POWERLEVEL9K_BATTERY_BACKGROUND="black"
POWERLEVEL9K_BATTERY_LOW_FOREGROUND="red"
POWERLEVEL9K_BATTERY_CHARGING_FOREGROUND="yellow"
POWERLEVEL9K_BATTERY_CHARGED_FOREGROUND="green"
POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND="green"
POWERLEVEL9K_BATTERY_LOW_THRESHOLD=15
POWERLEVEL9K_BATTERY_VERBOSE=false
POWERLEVEL9K_BATTERY_STAGES=('\uf244 ' '\uf243 ' 
                             '\uf243 ' '\uf243 ' 
                             '\uf242 ' '\uf242 ' 
                             '\uf241 ' '\uf241 ' 
                             '\uf241 ' '\uf240 ')

Cause seems to be acpi -b being slow, unknown why.

Martmists-GH avatar Nov 21 '19 00:11 Martmists-GH

Back in 2008 there was an app for iPhone called I Am Rich. It costed $999.99 and didn't do anything.

The application is described as "a work of art with no hidden function at all", with its only purpose being to show other people that they were able to afford it.

I had a similar idea for prompt segments that would do nothing useful except expressing users' virtues. By sporting I Am Generous segment in your prompt you can show everyone how generous you are with screen real estate. Do you have laid back personality, living an unhurried life? Let everyone know with I Am Patient segment that takes 5 seconds to load. Send the supercharged I Am Generous AND Patient message with the exclusive battery segment!

romkatv avatar Nov 21 '19 07:11 romkatv

I don't know why acpi -b is slow. As far as I understand its doings it mainly reads a few files from your sysfs (which is not located on any disk but in memory). The requirement for acpi was removed on the next branch and replaced with reading exactly those files needed for identifying battery status directly. I'm not clear on the timeline of merging next into master.

Could you test if you are having the same slowdown issue with the battery segment on next?

@romkatv Maybe you could open a pull request to add such a segment? I'm sure it would be of great value for lots of people :laughing:.

Syphdias avatar Nov 21 '19 23:11 Syphdias