angular/angular.dart — pull request #74 by cbracken (2013-08-13 06:44:02+00:00)
Title: Improved Zone.assertInZone() performance, API

When dart2js-compiled, Zone.assertInZone() carries a high CPU cost, primarily due to the cost of capturing the stack trace via a try-catch, pushing an async throw and verifying whether it executed in the zone.

This patch involves two changes:
1. Replace assertInZone() with a lest costly synchronous version that only throws when not executing in the zone
2. Replace assertInZone() with a boolean getter, runningInZone. Callers are then free to use assert(zone.runningInZone) if they want a stack trace. Since asserts are optimized out when running in unchecked mode, this carries no cost in production.