英文:
How to check performance of switch and vavr's match?
问题
我对普通的 switch 和 Vavr 的 match 性能究竟有多大差异很感兴趣,有什么最简单的方法可以检查呢?
@edit
我已经检查过了,似乎 Vavr 的 switch 比普通的 Java switch 慢大约两倍。
英文:
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
答案1
得分: 1
你可以在代码块前后检查系统时间,例如:
startTime = System.nanoTime();
// 你的代码放在这里
endTime = System.nanoTime();
英文:
You can check the system time before and after your code block, for example:
startTime = System.nanoTime();
// your code goes here
endTime = System.nanoTime()
专注分享java语言的经验与见解,让所有开发者获益!
评论