There are no performance gains from keeping the collision list sorted. Tried many tests and nothing. Tried to optimize mkautofn, to speed up sourcing zcompdump. The idea is simple – make single allocation, not two. However also no performance gains visible: @@ -3483,15 +3483,15 @@ mkautofn(Shfunc shf)  {      Eprog p; -    p = (Eprog) zalloc(sizeof(*p)); +    p = (Eprog) zalloc(sizeof(*p) + 5 * sizeof(wordcode));      p->len = 5 * sizeof(wordcode); -    p->prog = (Wordcode) zalloc(p->len); +    p->prog = (Wordcode) (((char*)p)+sizeof(*p));      p->strs = NULL;      p->shf = shf;      p->npats = 0;      p->nref = 1; /* allocated from permanent storage */      p->pats = (Patprog *) p->prog; -    p->flags = EF_REAL; +    p->flags = EF_REAL_SINGLE; /* no allocation for p->prog */ Attached is a full patch. Maybe it will inspire someone. I think that if sourcing time of zcompdump could drop from 55 ms to 35 ms it would be a great success. Tried callgrind on zsh -f sourcing the file, and it said: 22,888,884  _platform_strcmp [/usr/lib/system/libsystem_platform.dylib] 18,067,499  ImageLoaderMachOCompressed::trieWalk(unsigned char const*, unsigned char const*, char const*) [/usr/lib/dyld] 12,041,235  ecstrcode [/usr/local/bin/zsh]  4,877,588  _pthread_mutex_unlock_slow [/usr/lib/system/libsystem_pthread.dylib]  3,330,755  _pthread_mutex_lock_slow [/usr/lib/system/libsystem_pthread.dylib]  2,937,243  ingetc [/usr/local/bin/zsh]  1,854,600  stringsubst [/usr/local/bin/zsh] So there's no allocation there. Tried to find something in ecstrcode but no luck. Best regards, Sebastian Gniazdowski On 18 maja 2017 at 14:17:27, Sebastian Gniazdowski (psprint@zdharma.org) wrote: > On 18 maja 2017 at 12:15:29, Sebastian Gniazdowski (psprint@zdharma.org) wrote: > > Hello, > > it is really simple to keep collision lists sorted. However, I get error about typeset > > not being found. Debugged that typeset is inserted into builtintab. I am pretty exhausted, > > maybe someone will have a revelation on this. Debugged that typeset is being searched > > in: > > Found it, missing return NULL here below, writing so that no one wastes time, will now > test performance. -- Sebastian Gniazdowski psprint /at/ zdharma.org