It seems that the database is being queried for every variable when using '{all_fields}' in an email notification. I didn't think much of it until I saw how much slower that page was than others and getting the time profile graph it seemed that it could definitely be optimized. it seems to take about 80ms per call thru this path:
GFCommon::get_submitted_fields
GFormsModel::get_lead_field_value
RGFormsModel::get_field_value_long
wpdb::get_var
W3_Db::query
wpdb::query
And it is being done 17 times during the course of sending 2 emails of a form that has 6 fields.
It might be worth looking into caching the results of the query the first time around in a global variable and re-using that? (or some other way to optimize this, I'm not 100% sure of what exactly the code does, just that it ads 1s that I believe might be able to be shaved off)
Hope this can be of use!
-Steph