Hacker News new | past | comments | ask | show | jobs | submit login
Migrate From Oh-my-zsh to Prezto (jeromedalbert.com)
75 points by jdalbert on Aug 10, 2014 | hide | past | favorite | 23 comments

While this looks interesting, the main premise that oh-my-zsh is slow doesn't seem to hold up for me. I have a decently quick system, but nothing extreme and I don't notice much more lag with auto completion than I did with bash or fish. And I use auto completion excessively, and I'm not sparse with my oh-my-zsh plugins:

        plugins=(git golang archlinux catimg common-aliases compleat dircycle dirhistory sudo systemd urltools)
and also use other (non oh-my-zsh)"plugins" on top of that. Startup also isn't an issue and isn't any slower than it was before, and I'm using terminator which isn't exactly "light" by itself.

That being said, it looks interesting and I plan on fiddling around with it a bit.

I haven't measured it directly but I definitely noticed a speedup when I switched to zsh, probably in the 0.2s-0.4s range. I probably actually slimmed down a bit, I don't have any plugins and my .zshrc is mostly aliases and path management.

yea oh-my-zsh isn't that slow, most people who think it is slow either have it misconfigured or have a really, really slow system

I ran a little comparison with both Oh-my-zsh and Prezto with roughly the same plugins: http://i.imgur.com/cDSRZuO.png. There's almost a 0.4s difference. In practice it makes for a noticeable 0.5-1s difference (with all the other stuff I have in my .zshrc).

I have a fast system (Core i5, SSD), but tab completion is often very slow.

I just checked my `oh-my-zsh/plugins` directory, and there are 173 plugins, most of which I don't need.

Should I purge them?

Edit: browsing through the (oh-my-)zsh files, I can see that it only loads the plugins found in the `plugin` environment variable, so I guess the answer is no. The only plugin enabled is `git`.

My theme is also very basic (git and mercurial status).

Any advice to improve performance?

FWIW - There is a known issue with Apple's built-in-git and the Git oh-my-zsh plugin that really slows down prompt redraws. it has to do with the way the built in Git does repository polls, I believe. The solution is to install the latest Git client (preferably via Homebrew or whatever).

I tested opening a new iTerm 2 tab on my late-2009 MBP and it takes 3.5-4s for the prompt to appear with oh-my-zsh enabled.

I would love to know what I've got misconfigured.

Definitely not a misconfiguration. I had the exact same issue after a certain period of time with every fresh install. The solution was switching to Prezto / fish (work / home respectively).

Something I noticed after migrating to oh-my-zsh while still on a spinning drive - if you're on a mac and clear out your system logfiles (rm /private/var/log/asl/*.asl), prompts begin to appear almost instantly even with ZSH.

I have no idea what is happening to cause this, but the performance difference is unmistakable.

FWIW - I'm pretty sure this is shell-independent. Happens with BASH as well.

huh, can confirm prompts are appearing faster. what the hell is this?

I forgot I did this about a year ago. I just did it again now and terminal launches instantly. I'm not sure when in the process it gets hung up, but these are Apple System Logs. Mine didn't look too bad; less than a hundred files taking less than 20mb or so.

Here's an article where they got rather excessive (84GB): http://forums.macrumors.com/showthread.php?t=641936

You can look at them if you want using: syslog -f <file.asl> | less

I should time the init and print a suggestion to delete the files if it goes over a threshold.

Why not just contribute the optimisations back to ohmyzsh? This was made to be a drop in replacement anyway.

If I remember correctly zprezto started as a huge pull request to oh-my-zsh that the author rejected. You can probably find it in the closed issues of oh-my-zsh.

Here it is. https://github.com/robbyrussell/oh-my-zsh/issues/377 (tl;dr seven-month fork that fixed over 100 issues)

TL;DR: Robby Russell wanted out-of-the-box functionality for newbies, and auto-updated turned on. Sorin Ionescu wanted better tailoring for experts and didn't want the auto-update which he saw as annoying.

Thus the split between the code bases.

To the larger issue of "my shell is slow", it's very helpful to profile it. I keep some standard startup profiling code[1] in my .zshrc that I enable when I need to profile things. In my experience, this virtually always identifies a very specific culprit for performance problems.

[1] https://github.com/jwhitley/zshrc/blob/master/.zshrc#L18

and https://github.com/jwhitley/zshrc/blob/master/.zshrc#L151

I prefer grml's zsh config [1]. It's used on the Arch Linux installation image. Has lots of completions and git support out of the box.

1. https://grml.org/zsh/

I'm still pretty fond of fish myself, mainly for the sane scripting. Wondering if it might be worth switching to zsh for the extra plugins and community support, though.

I'd also be very interested in this question. As a zsh user, I'm always eyeing fish, which seems to be getting better all the time.

I'm also interested in making bash tab completion behave a close as possible to zsh, just for those servers where installing zsh is a hassle. Never found a way. It's always slightly different, and thus very annoying.

Is it actively maintained? The article is from May 2014 and last commit in repo is 4 months ago.

Looks active to me: the repo owner actively participates in bugs/PR opened days or hours ago. As for the article, I started it in May, forgot about it, then released it today. Hence the May 2014 date.

Nice writeup, Jerome! While I personally do not suffer from a slow down on ohmyzsh, I will give prezto a shot because why not, using your guidance.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact