Search code examples
javaswitch-statementvavr

How to check performance of switch and vavr's match?


I am intrested how does exacly switch vs vavr's match performance seems, what is the easiest wy to check it?

@edit

I checked it, it seems like vavr's switch is like 2x slower than regular java switch


Solution

  • You can check the system time before and after your code block, for example:

        startTime = System.nanoTime();
        // your code goes here
        endTime = System.nanoTime()