如何检查 switch 和 vavr 的 match 的性能?

huangapple go评论105阅读模式
英文:

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()

huangapple
  • 本文由 发表于 2020年4月8日 00:59:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/61085350.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定