G3Kappa / Ergo

Other
4 stars 0 forks source link

Rollback IAsyncEnumerable support in favor of plain IEnumerables #54

Closed G3Kappa closed 1 year ago

G3Kappa commented 1 year 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.

G3Kappa commented 1 year 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.

G3Kappa commented 1 year 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.