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

Optimize CLI commands performance #104

Open
nikitabobko opened this issue Jan 6, 2024 · 0 comments
Open

Optimize CLI commands performance #104

nikitabobko opened this issue Jan 6, 2024 · 0 comments
Labels
problem Neither a bug, nor a feature request

Comments

@nikitabobko
Copy link
Owner

aerospace list-workspaces is slow. Well, aerospace list-workspaces is ~100ms which by itself is fine.

(1) But 100ms is the result when AeroSpace is idle. Currently AeroSpace performs all operations in one thread. Considering that Ax calls are blocking, 100ms becomes worse when a lot of Ax calls are performed.

It can be tested with alt-w = ['workspace W', 'exec-and-forget bash -c "time ~/.bin/aerospace list-workspaces" 2> ~/log']. I have 9 windows opened, and I get 300ms in ~/log. 300ms is not that nice

(2) The problem becomes worse when users need to call aerospace list-workspaces several times (E.g. to get all workspaces and focused workspaces). list-workspaces is designed to be called several times. Maybe the design could be reconsidered, or --json flag could be provided. With JSON format, AeroSpace could dump out all the info it knows about workspaces in a structured way.

Reported at: #81

nikitabobko added a commit that referenced this issue Jan 8, 2024
Motivation:
1. Small optimization. One less client-server hoop.
   #104

   Before the commit

      (debug, idle)
      time aerospace list-workspaces --all
      real    0m0.041s
      user    0m0.002s
      sys     0m0.001s

      (debug, busy, 8 windows)
      alt-w = ['workspace W', 'exec-and-forget bash -c "time /Users/bobko/a/AeroSpace/LocalPackage/.build/debug/aerospace list-workspaces --all" 2> ~/log']
      real    0m0.165s
      user    0m0.002s
      sys     0m0.001s

   After the commit

      (debug, idle)
      time aerospace list-workspaces --all
      real    0m0.024s
      user    0m0.002s
      sys     0m0.002s

      (debug, busy, 8 windows)
      alt-w = ['workspace W', 'exec-and-forget bash -c "time /Users/bobko/a/AeroSpace/LocalPackage/.build/debug/aerospace list-workspaces --all" 2> ~/log']
      real    0m0.145s
      user    0m0.004s
      sys     0m0.004s

2. Now if server and client have different versions, but understand each
   other, the error is not reported
@nikitabobko nikitabobko added the problem Neither a bug, nor a feature request label Mar 21, 2024
@nikitabobko nikitabobko changed the title Optimize query commands performance Optimize CLI commands performance Aug 14, 2024
jakenvac pushed a commit to jakenvac/AeroSpace that referenced this issue Aug 16, 2024
Motivation:
1. Small optimization. One less client-server hoop.
   nikitabobko#104

   Before the commit

      (debug, idle)
      time aerospace list-workspaces --all
      real    0m0.041s
      user    0m0.002s
      sys     0m0.001s

      (debug, busy, 8 windows)
      alt-w = ['workspace W', 'exec-and-forget bash -c "time /Users/bobko/a/AeroSpace/LocalPackage/.build/debug/aerospace list-workspaces --all" 2> ~/log']
      real    0m0.165s
      user    0m0.002s
      sys     0m0.001s

   After the commit

      (debug, idle)
      time aerospace list-workspaces --all
      real    0m0.024s
      user    0m0.002s
      sys     0m0.002s

      (debug, busy, 8 windows)
      alt-w = ['workspace W', 'exec-and-forget bash -c "time /Users/bobko/a/AeroSpace/LocalPackage/.build/debug/aerospace list-workspaces --all" 2> ~/log']
      real    0m0.145s
      user    0m0.004s
      sys     0m0.004s

2. Now if server and client have different versions, but understand each
   other, the error is not reported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem Neither a bug, nor a feature request
Projects
None yet
Development

No branches or pull requests

1 participant