When to use short?

前端 未结 4 606
心在旅途
心在旅途 2021-01-20 03:23

Say I\'m looping through like 20/30 objects or in any other case where I\'m dealing with smaller numbers, is it a good practice to use short instead of int?

I mean w

4条回答
  •  离开以前
    2021-01-20 03:41

    Yes, the performance difference is negligible. However, a short uses 16 bits instead of 32 for an int, so it's conceivable that you may want to use a short if you're processing enough small numbers.

提交回复
热议问题