dart-lang / fake_async

Fake asynchronous events for deterministic testing.
https://pub.dev/packages/fake_async
Apache License 2.0
90 stars 16 forks source link

Allow FakeAsync to disable creation StackTraces in FakeTimers #40

Closed jonahwilliams closed 2 years ago

jonahwilliams commented 2 years ago

I am currently using FakeAsync in a prototype microbenchmark suite. The eager stack trace creation for timers is fairly expensive and ends up showing up in the top ~N CPU %.

This patch allows this functionality to be disabled in the FakeAsync constructor by passing includeTimerStackTrace: false (the default is true). This patch avoids a breaking change to the FakeTimer api using a null checked getter which can throw, but only if the user has opted into a new parameter.

jonahwilliams commented 2 years ago

Thanks @natebosch !