perf(API): Tune middleware execution

Improve performance of interating through middleware components by
performing the getattr lookups ahead of time. Also push and pop from
the tail of the middleware stack, rather than the head, since that
is more efficient for the underlying list type.
Merge pull request #367 from kgriffs/0.2-tuning

perf(API): Tune middleware execution