slow performance of loom continuations

seth lytle seth.lytle at gmail.com
Mon Sep 10 15:16:43 UTC 2018


> no-one believes

then choose not to believe

but could someone answer the questions regardless, which are orthogonal to
the exact numbers ? to recap:

- am i using the api correctly ?
- is performance on a shallow loop like this a use-case that the loom team
considers important ?


to simplify discussion, here's the example stripped of all the output
(other than what's needed to keep the jvm honest):


public class Xorshift {
    static final ContinuationScope SCOPE = new ContinuationScope() {};
    Continuation ctu = new Continuation(SCOPE,this::execute);
    long result;

    public void loop() {
        long val = 0;
        for (int ii=0; ii < 200000; ii++) {
            ctu.run();
            val = val ^ result;
        }
System.out.println(val);
    }
    public void execute() {
        long x, y, s0=103, s1=17;
        while (true) {
            x = s0;
            y = s1;
            s0 = y;
            x ^= (x << 23);
            s1 = x ^ y ^ (x >> 17) ^ (y >> 26);
            result = (s1 + y);
            Continuation.yield(SCOPE);
        }
    }

    public static void main(String[] args) {
        Xorshift xor = new Xorshift();
        for (int jj=0; jj < 10; jj++)
            xor.loop();
    }
}

































On Mon, Sep 10, 2018 at 4:27 AM, Andrew Haley <aph at redhat.com> wrote:

> On 09/07/2018 07:42 PM, seth lytle wrote:
> >> Could I recommend JMH?
> >
> > this isn't intended as a benchmark (kilim does have some but i haven't
> > looked at them). but this example has been representative of how i use
> > kilim
>
> Right, but these days no-one believes performance measurements that don't
> use JMH. Rewriting your test in JMH would make it easier to understand
> the performance issues, and JMH has excellent tools to analyze and pinpoint
> slowdowns.
>
> --
> Andrew Haley
> Java Platform Lead Engineer
> Red Hat UK Ltd. <https://www.redhat.com>
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
>


More information about the loom-dev mailing list