Python API: session split operation seems slow
- iTerm2 version: Build 3.3.20190907-nightly
- OS version: MacOS 10.14.6 (18G95)
- Hardware: MacBook Pro (15-inch, 2018) / 2.9 GHz Intel Core i9 / 32 GB 2400 MHz DDR4
I find the speed of creating split slow when comparing what I can do through key bindings and through the python API. I don't have my old apple script based script to compare head to head but I observed 2 things:
- creating a split via API is slow (almost 0.35s on average)
- trying to create them in parallel doesn't seem to help much (a long pause and them they all show up, slightly faster than doing them sequentially). I'm not familiar with Python's asyncio so maybe I'm doing it wrong (see the code attached).
The debug log was too big so I didn't attach it but hopefully the script is enough to reproduce what I see. I'm happy to provide more information (CPU profile, ...).
./session_focus.py
--< splits: 2 >-----------------------------------
sequential: start splitting sessions
sequential: done splitting sessions in 0.713 seconds
sequential: start running commands in sessions
sequential: done running commands in 0.004 seconds
parallel: start splitting sessions
parallel: done splitting sessions in 0.679 seconds
parallel: start running commands in sessions
parallel: done running commands in 0.002 seconds
--< splits: 8 >-----------------------------------
sequential: start splitting sessions
sequential: done splitting sessions in 3.031 seconds
sequential: start running commands in sessions
sequential: done running commands in 0.015 seconds
parallel: start splitting sessions
parallel: done splitting sessions in 2.688 seconds
parallel: start running commands in sessions
parallel: done running commands in 0.017 seconds
--< splits: 16 >-----------------------------------
sequential: start splitting sessions
sequential: done splitting sessions in 6.416 seconds
sequential: start running commands in sessions
sequential: done running commands in 0.101 seconds
parallel: start splitting sessions
parallel: done splitting sessions in 5.455 seconds
parallel: start running commands in sessions
parallel: done running commands in 0.122 seconds