data icon indicating copy to clipboard operation
data copied to clipboard

idea: faster store teardown

Open runspired opened this issue 2 years ago • 2 comments

Currently, when the store is destroyed we iterate and unload all records. This takes a surprisingly large amount of time. In many of ember-data's tests ~20-30% of time spent is spent in our store's destroy lifecycle during teardown.

Unfortunately, we can't simply "not tear things down", because stores are also destroyed for fastboot app instances and cleanup is important for ensuring memory leaks don't happen.

We should re-examine what we actually do/do-not need to cleanup for fastboot/tests and figure out if there isn't a way to do less work.

For ember-data, this could improve our test-suite performance from ~35s to ~25s per test run. While this might not seem like much, we run our tests ~30x/commit to cover all the various scenarios (~3.5min saved). And ember-data only has ~1700 tests. Applications with far larger test suites could significantly benefit from faster teardown, especially those based on libraries like miragejs which encourage over-mocking or which require setting up large amounts of data for even basic acceptance and integration tests.

runspired avatar Jul 25 '22 18:07 runspired

#8084 significantly improved the teardown case. Likely still more wins out there. Differentiating between "store is tearing down" and "unloadAll was called" would be the key.

runspired avatar Aug 12 '22 08:08 runspired

a big boost was found in #8122 but there's probably still a few more big leaps out there.

runspired avatar Aug 17 '22 00:08 runspired

going to close for now as I think current gains have eliminated lowest hanging fruit. Once we no longer extend anything from EmberObject we should revisit.

runspired avatar Aug 21 '23 05:08 runspired