Major performance boost for form properties

http://manage.dimagi.com/default.asp?146259

`a.id != self.app.id` yields the largest performance improvement any change in this PR. This eliminates redundant calculation of the original app's case properties for each case type, which gives an exponential improvement. Request time on my local machine decreased from ~1m to ~10s.