performance of byte vs. int in .NET

后端 未结 5 633
伪装坚强ぢ
伪装坚强ぢ 2021-01-17 18:49

In pre-.NET world I always assumed that int is faster than byte since this is how processor works.

Now it\'s matter habit of using int even when bytes could work, fo

5条回答
  •  囚心锁ツ
    2021-01-17 19:53

    Unless you are finished with your design and need to find clever ways to optimize, then just use what you need.

    If you need a counter or are doing basic math, it is probably what you want, if you're working with binary data, go with a byte.

    In the end, each type should be optimized for it's intended purposes, so you're better off to spend your time on design instead of optimization.

提交回复
热议问题