Future.get() performance

August Nagro augustnagro at gmail.com
Thu Apr 28 20:05:07 UTC 2022


Hello,

It's very exciting to see that Loom is going into preview.. thank you for
the hard work.

I noticed in the JEP page that this example of interoperability with
Futures was given:

response.send(future1.get() + future2.get());

Have there been any thoughts about improving the performance of .get()
under loom?

My understanding is that the method is implemented by submitting a
ManagedBlocker to the fork join pool, which polls the future every X
milliseconds until it's completed.

I would think that instead, you could have some special logic if the thread
is virtual.

It would directly suspend the continuation, and add a callback to the
future. When the future completes, the callback is executed, allowing the
continuation to be resumed.


More information about the loom-dev mailing list