update-index: new options to enable/disable split index

Enabling split-index mode is special, it does not follow the normal
split-index update rule that either one can be updated at a
time. Instead it will write both indexes in locked state, then commit
index.ext then index. The reason for this is we'll have the main index
with dead extensions that take part in .git/index rehash.

On gentoo-x86.git (117k files, 25k dirs), "git status" after touching
one file, without split-index

    89.153ms gitmodules_config:201 if (read_cache() < 0) die("index file
     0.003ms cmd_status:1296 read_cache_preload(&s.pathspec);
   122.678ms cmd_status:1299 refresh_index(&the_index, REFRESH_QUIET
   104.844ms cmd_status:1303 update_index_if_able(&the_index, &index_lock)
     3.355ms wt_status_collect:616 wt_status_collect_changes_worktree(s)
     4.430ms wt_status_collect:621 wt_status_collect_changes_index(s)
   350.394ms wt_status_collect:622 wt_status_collect_untracked(s)

and with split-index

   108.693ms gitmodules_config:201 if (read_cache() < 0) die("index file
    22.229ms cmd_status:1296 read_cache_preload(&s.pathspec);
   126.101ms cmd_status:1299 refresh_index(&the_index, REFRESH_QUIET
    19.500ms cmd_status:1303 update_index_if_able(&the_index, &index_lock)
     3.127ms wt_status_collect:616 wt_status_collect_changes_worktree(s)
     5.236ms wt_status_collect:621 wt_status_collect_changes_index(s)
   364.873ms wt_status_collect:622 wt_status_collect_untracked(s)

The important line is update_index_if_able. Other lines are shown for
a complete "git status" timing picture. write time is reduced by
80%. read time is increased by 20%. We reduce about 60ms.

Index read time could be reduced by keeping the index in memory, in a
daemon so we don't have to rehash the entire index every time we read
it.
read-cache: new extension "dirc" for recording/replaying index changes

This extension is to be used in split-index mode only. The extension
is stored in "index.ext" and works like a patch to "index". It records
what entry has been added, changed or removed. At load time, those
changes are applied to the in-memory index. Like a patch, it's
supposed to be much smaller to carry around than the final output,
which means faster update time. This patch is to introduce the
extension. The real meat will be added in later patches.
split-index: save the main index listing after reading

We need to keep this to identify updated or removed entries. The
position of each index entry is also saved in the entry itself, so we
know its position in the original listing. We need this quickly locate
the entries at load time without looking them up by name.
read-cache: save deleted entries in dirc extension

References to deleted entries are in dirc->original. We just need to
not free them, and mark them deleted. And mark that entry removal
should not lead to merging index.ext back to index.
read-cache: mark new entries for dirc extension

CE_ADDED is not a good fit because it does not differentiate replaced
and added entries. Moreover it's used as a temporary flag in
unpack_trees(). Make sure entry addition does not lead to merging
index.ext back to index.
read-cache: mark replaced entries for dirc extension
read-cache: export create_from_disk() for use in dirc extension

While at there, fix constness of "ondisk" and keep the type
ondisk_cache_entry to read-cache.c only.
read-cache: add index_entry_to_strbuf()
split-index: code for reading dirc extension

The extension consists of three separate parts for deleted, replaced
and added entries. Deleted entries are cheap: each one is represented
by one bit. Replaced entries are stored _without_ paths, which is
encoded in another bitmap. Added entries are stored no different the
main index.
split-index: code for writing dirc extension

We are not very strict at flagging CE_REMOVE, CE_UPDATE_IN_DIRC or
CE_ADD_IN_DIRC earlier. So we have to deal with the combination of
flags here. Detailed comments in code.

An observation is, deleting an entry, then adding it back is recorded
as "entry X is deleted, entry X is added", not "entry X is replaced".
This is simpler, with small overhead: a replaced entry is stored
without its path, a new entry is store with its path.
split-index: patch the index with data from dirc extension
1
force split-index mode on new indexes
Add TIME() macro for measuring how long a block is executed

Convenient macro to measure how long a code block takes. Support
nested timing. _Not_ meant to be actually used in official code.
TIME()