为什么if else过多会影响程序性能?(英文版)

“If else” uses in the following two scenarios: exception logical process and different condition process.

1 Why will it affect the performance of the program?
When we have a short code, it won’t effect too much, but when we have a large program with lots of if-else and we can’t just get away with it, then we need to pay attention at details listed in following: if(A and B), we need to put a more-likely-to-be-false as A. if(A or B), we need to put a more-likely-to-be-true as A;
2 Ways to refactor them.
3 If else optimization in web application in 4400

Reference URL: https://blog.csdn.net/qq_35440678/article/details/77939999 很有用处 但是没有看懂他说的针对条件性代码重构所把握的一个原则:尽可能维持正常流程代码在最外层,保持主干流程是正常核心流程。

posted @ 2020-12-26 00:13  EvanMeetTheWorld  阅读(22)  评论(0)    收藏  举报