giovinazzo-kevin / Ergo

Other
4 stars 0 forks source link

Rollback IAsyncEnumerable support in favor of plain IEnumerables #54

Closed giovinazzo-kevin closed 2 years ago

giovinazzo-kevin commented 2 years ago

AsyncEnumerables are very expensive. They were initially introduced for data sinks and sources, but seeing as those are a fringe feature that is not standard Prolog, they don't warrant a massive penalty to performance. Those will need to be implemented some other way, such as by blocking the calling thread.

giovinazzo-kevin commented 2 years ago

It is worth mentioning that although builtins should probably not invoke async code, user-written builtins could.

A new type of "thread context" should be created such that whenever some code needs to await something, it can do that properly while blocking the calling thread.

giovinazzo-kevin commented 2 years ago

A new type of "thread context" should be created such that whenever some code needs to await something, it can do that properly while blocking the calling thread.

Calling IAsyncEnumerable.ToEnumerable() in pull_data seems to do the trick.