The bottleneck in my app is the creation of the UTXO db. Even with a ram disk and leveldb, building it takes about 1h for the current blockchain. In comparison, script verification is only ~15 mn because it is CPU bound and easily parallelizable. Leveldb spends a large portion of time deleting and recompacting its sorted tables because tx hashes are basically random.
I haven't found a way to improve that part. It's not so bad since it's only done once but still.
Why don't you write the UTXO as a huge LevelDB batch write (or a series of batches, depending on your failure-tolerance without having to restart the whole process)?
Apart from its atomicity benefits, WriteBatch may also be used to
speed up bulk updates by placing lots of individual mutations into the
same batch.