What is a “tight loop”?

前端 未结 8 712
说谎
说谎 2020-12-01 06:56

I\'ve heard that phrase a lot. What does it mean?

An example would help.

8条回答
  •  天涯浪人
    2020-12-01 07:31

    I think the phrase is generally used to designate a loop which iterates many times, and which can have a serious effect on the program's performance - that is, it can use a lot of CPU cycles. Usually you would hear this phrase in a discussion of optimization.

    For examples, I think of gaming, where a loop might need to process every pixel on the screen, or scientific app, where a loop is processing entries in giant arrays of data points.

提交回复
热议问题