读书人

C#和java的错误处理性能对比

发布时间: 2013-02-24 17:58:56 作者: rapoo

C#和java的异常处理性能对比

刚刚接触C#,据说C#的异常处理很耗费性能。

于是来做个测试。

public class Test {public static void main(String[] args) {long start = System.currentTimeMillis();for(int i=0; i<1000; i++){try{Integer.parseInt(null);}catch(Exception e){}}System.out.println(System.currentTimeMillis()-start);}}
输出结果为:

2


差距也够大的!看来姜还是老的辣啊,微软优化的还不够……

读书人网 >C#

热点推荐