question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ZSH config file is really heavy

See original GitHub issue

Hi,

I tried to source $(pew shell_config) in my .zshrc to have a feedback on the venv I am using, in my prompt. However, it adds 2 extra seconds or so to spawn a new ZSH shell, which is a lot for such a basic feature.

Is it normal? Expected?

Thanks

EDIT: Plus it messes with my PS1, breaking new lines etc.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mjlbachcommented, Apr 28, 2018

@ashwinvis There are two ways to speed up a shell start using pew.

  1. If you’re using a framework like Oh My Zsh or Prezto that loads compinit, you can see a large speedup by deleting compinit from line 2 of PEW’s init.zsh file. For example, mine is located at “/usr/local/lib/python3.6/site-packages/pew/shell_config/init.zsh” As long as pew is sourced after the framework (at the end of .zshrc in my case) this will result in a speedup of roughly 0.7 seconds without losing completion. Loading completion is one of the biggest slowdowns with shell startup.

  2. If you use the python2 package for pew, shell start-up is about 0.2 seconds faster, presumably because python 2 still starts up faster than python 3 (even 3.7 by ~2 fold)

1reaction
Phykscommented, May 30, 2016

Let me know if you have any test in mind that I could do to debug it further.

Here is a quick comparison on another laptop, same issue:

Without the source line:

% time zsh -c "source /home/lucas/.zshrc"
zsh -c "source /home/lucas/.zshrc"  0,05s user 0,01s system 103% cpu 0,060 total

With the source line:

% time zsh -c "source /home/lucas/.zshrc"
zsh -c "source /home/lucas/.zshrc"  0,38s user 0,11s system 99% cpu 0,494 total
Read more comments on GitHub >

github_iconTop Results From Across the Web

oh-my-zsh config file not loading - Stack Overflow
I figured this out. It was due to my config file. The part of the zsh config that wasn't loading needed to be...
Read more >
Create a secure configuration file for zsh scripts
Is that a config file for the shell session in general (like .zshrc and such), or for some other tool you provide? I.e....
Read more >
zsh starts incredibly slowly - Super User
My ~/.zsh_history measured 1.8MB. Its very possible to accidentally paste a large chunk of stuff as a command into a terminal, this will...
Read more >
Speeding up zsh and Oh-My-Zsh - JonLuca's Blog
This can be slightly fixed with git config oh-my-zsh.hide-status 1 on problematic repos, but it would be nice if it did so automatically....
Read more >
Better zsh history - SoberKoder
By saving history to a file, and by letting the file grow very large, more commands can be retained and be available for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found