In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the "how to analyze and improve the compilation speed of the Cramming + program". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to analyze and improve the compilation speed of the Cramp Craft + program".
Caused by hardware and compiler
Using a better computer is undoubtedly the best choice for operation. Secondly, compiler options can also be optimized for compilers. For example, in VS environment, you can configure properties. The specific steps are as follows. Please refer to: https://blog.csdn.net/yizhou2010/article/details/52635288
Coding style
Use more self-addition, self-subtraction instructions and compound assignment expressions
Do you think there is any difference between using iTunes +, I = I + 1 and I + = 1? Let's test the C code:
Void asd () {} int main () {int iTun0; iTunes; asd (); / / facilitate context-sensitive ii=i+1; asd (); iTunes 1; return 0;}
Disassembly:
Mov [rbp+i], initialization of call I [rbp+i], 1 rbp+i; call _ Z3asdv; asd (void) add [rbp+i], 1 rbp+i; call _ Z3asdv; asd (void) add [rbp+i], 1//i+=1
We see that the result is the same, but a few more instructions are generated in more complex expressions, and using I + = 1 is always slightly better than writing I = I + 1.
To express division by multiplication or shift.
Division is derived from the process of multiplication, subtracting (if x is enough) y ^ (2 ^ 31), y ^ (2 ^ 30),. Y ^ 8, y ^ 4, y ^ 2, y ^ 1. Subtract the corresponding amount of y and add the corresponding amount to the result. Generally speaking, it takes more time. Test it with a demo.
Auto time_start = std::chrono::system_clock::now (); int iCount = 1000000; double k; for (int I = 0; I < 1000000; iTunes +) {tmp = iCount / 2;} std::chrono::duration time_spend = std::chrono::system_clock::now ()-time_start; double test1 = time_spend.count () * 1000; cout
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.