[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: compgen is slow for large numbers of options
From: |
Geir Hauge |
Subject: |
Re: compgen is slow for large numbers of options |
Date: |
Mon, 19 Mar 2012 23:13:40 +0100 |
2012/3/19 Chet Ramey <chet.ramey@case.edu>:
> I will look at optimizing that function, but it's always going to take time
> to plow through 300K when you have to split it into words. (There's not
> actually any word splitting of consequence happening with your second
> example using the pipeline.)
Letting compgen do the command substitution speeds it up considerably
$ TIMEFORMAT=%R
$ time compgen -W "`seq 1 500000`" 1794 >/dev/null
175.253
$ time compgen -W '`seq 1 500000`' 1794 >/dev/null
2.347
--
Geir Hauge