Warm Up effect on query performance

I'm using v0.19 right now and plan to switch to v0.20 (where there's an
automatic warm up of shards). I am doing some query optimization and
performance testing. I find that after a few queries performance gets
significantly better (from couple of minutes to seconds). These are filter
queries containing ~10-1000 randomly generated keywords (there's a very
small chance of the same query containing the same being issued again). Is
this using the segment caches? Loading indices into memory?

I have found this effect mentioned in a few places, but am still not clear
on why it works this way:
a) Herehttps://groups.google.com/forum/?fromgroups=#!topic/elasticsearch/x7REgAihCsw,
Shay mentions that doing 100-1000 queries to 'warm up' will help performance
b) For ES v0.20, there's an automatic warm uphttps://github.com/elasticsearch/elasticsearch/issues/1913of shards.

Thanks!
Sushant

--