After #1007 and #1010, bitcoin-qt is now taking around 25 seconds to quit cleanly. It seems to be writing a whole new copy of the blockchain.
I added code to time the flushes that happen in db.h and saw that it's taking 24s to flush the blockindex now:
addr.dat flush
addr.dat flush done in 127ms
blkindex.dat refcount=0
blkindex.dat flush
UPNP_DeletePortMapping() returned : 0
ThreadMapPort exiting
connection timeout
ThreadOpenConnections exiting
blkindex.dat flush done in 23975ms
I'm not sure which commit introduced this slowdown. rc1 quits in 12s for me. I'll find out and report back.
Update: 89516bd4e ("Speed up block downloading") is the commit that made the shutdown time double. If I comment out just the line that says:
dbenv.set_cachesize(nDbCache / 1024, (nDbCache % 1024)*1048576, 1);
then the shutdown speed goes back to 12s.
To see this effect more strongly, try running "bitcoin-qt -dbcache=250" then quitting immediately. The window disappears straight away, but the process thrashes the hard drive for over 3 minutes before shutting down. Maybe that's just the cost of using a disk cache though.