哪个在性能方面更好?测试布尔值是否为真或一直设置它?

Which is better in terms of performance? To test whether a boolean is true or set it all the times?

例如在一个很长的循环中:
(bool x;)

要经常测试它:

if (!x) x = true;

或者一直将其设置为真:

x = true;

更重要的是,无条件赋值更易于阅读。此类代码的执行频率极不可能足以影响任何程序的整体性能。