tc39 / proposal-signals

A proposal to add signals to JavaScript.
MIT License
2.87k stars 54 forks source link

Add GC tests #176

Open robbiespeed opened 1 month ago

robbiespeed commented 1 month ago

This adds 3 new tests, 2 of which currently fail:

The impacts of the two failing tests are bounded, so it's more of a memory deficiency than a full on leak.

Required updating viteconfig to expose gc, doesn't appear to work inside the default pool type. Also WeakRef wasn't usable in spec files, hence adding the nested tsconfig. Doing so enforced strict mode on the spec file so a few further updates to the types were made to appease the type checker.

robbiespeed commented 3 weeks ago

Something to consider is how strict these tests should be. There's optimisations that can be made if for example things are more lazily opened up for collection by GC. For example switching a complex branch of the graph from "live" to "not-live" can be expensive, so it might make sense to delay such an action, but doing so would keep some things around longer than necessary.