Code optimization

后端 未结 3 1640
鱼传尺愫
鱼传尺愫 2021-01-29 16:07

When i\'m trying to optimize my code, I often run into a dilemma:

I have an expression like this:

int x = 5 + y * y;
int z = sqrt(12) + y * y;

3条回答
  •  情深已故
    2021-01-29 17:05

    Trying to optimize your code most often means giving the compiler the permission (through flags) to do its own optimization. Trying to do it yourself will more often then not, either just be a waste of time (no improvement over the compiler) or worse.

    In your specific example, I seriously doubt there is anything you can do to change the performance.

提交回复
热议问题