Hilarious [Or Not So Hilarious] Code Optimizations

前端 未结 3 2108
说谎
说谎 2021-02-06 18:23

Raymond Chen has this to say on his recent post on code optimizations... Obvious optimizations - one that begs to be optimized - tend to be \"de-optimizations\" if you conside

3条回答
  •  醉话见心
    2021-02-06 18:26

    My favourite is

    // original code
    int a[10];
    a[5] = 3;
    
    // optimized code
    int a[10];
    *(a + 5) = 3;
    

    Yes, all of a sudden, that's magically faster!!

提交回复
热议问题