Tag: 过早优化

如何编写更高效的代码

世纪的问题? 我基本上想知道如果我将这段代码写成几个不同的变量或者我使用的是小数组,哪个会更有效。 int x = 34; int y = 28; int z = 293; VS double coordinate[3] = {34, 28, 293}; 我有一个坐标结构,我将按以下方式使用: typedef struct coordinates_t { double x = 0.0; double y = 0.0; double z = 0.0; } coordinates; typedef struct car_t { coordinates start; // car starting point coordinates location; // car current […]