dotcloud/docker — pull request #5798 by unclejack (2014-05-14 15:14:26+00:00)
Title: don't update Suffixarray for every Register during startup

This refactors TruncIndex so that we can add items to it without updating the Suffixarray. This refactored TruncIndex is used in daemon/daemon.go to speed up the daemon's startup by calling UpdateSuffixarray only when we're done registering containers during startup.

This fixes the slow startup encountered with a large number of containers.

Here are the numbers from a system with 2006 containers:
```
unpatched: restore() - 38.267634801s
patched: restore() - 764.710999ms
50x improvement for 2006 containers
```

This has reduced the total startup time down to around one second.