You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@syg expressed the concern at TC39 that JS developers may allocate too many AsyncContext variables, slowing down their programs and creating unmanageable expectations on JS engines to make it fast somehow. In general, I think the best practice is for each library or framework to create just one AsyncContext variable. But could we actually enforce a limit on the total number of variables created?
In general, in JS, the specification does not indicate hard limits for real resources like the heap size or the callstack size--it's just implicit that the JS engine may throw an exception or terminate if unspecified limits are exceeded. On the other hand, WebAssembly has standardized its implementation-defined limits at https://webassembly.github.io/spec/js-api/#limits . I wonder if, in JS, we could agree on implementation-defined limits for certain aspects of certain new features, like this.
What if we had an overall limit of AsyncContext variables, after which an exception is thrown if JS tries to allocate more? Maybe this could be 1000 or 10000--I really can't imagine valid use case requiring more than that.
The text was updated successfully, but these errors were encountered:
Yeah, I think if we come up with a good data structure for the AsyncContext.Snapshot representation (as investigated in this design doc), there shouldn't really be a need to limit the number of AsyncContext.Variable instances allocated. But we might want to leave this issue open to be resolved during Stage 3, to track any issues which may come up.
@syg expressed the concern at TC39 that JS developers may allocate too many AsyncContext variables, slowing down their programs and creating unmanageable expectations on JS engines to make it fast somehow. In general, I think the best practice is for each library or framework to create just one AsyncContext variable. But could we actually enforce a limit on the total number of variables created?
In general, in JS, the specification does not indicate hard limits for real resources like the heap size or the callstack size--it's just implicit that the JS engine may throw an exception or terminate if unspecified limits are exceeded. On the other hand, WebAssembly has standardized its implementation-defined limits at https://webassembly.github.io/spec/js-api/#limits . I wonder if, in JS, we could agree on implementation-defined limits for certain aspects of certain new features, like this.
What if we had an overall limit of AsyncContext variables, after which an exception is thrown if JS tries to allocate more? Maybe this could be 1000 or 10000--I really can't imagine valid use case requiring more than that.
The text was updated successfully, but these errors were encountered: