Название: C++: Optimization Techniques Автор: Henry P. Delima Издательство: Amazon.com Services LLC Год: 2020 Страниц: 433 Язык: английский Формат: pdf, azw3, epub Размер: 10.1 MB
Why Optimization Is Necessary: Assuming that our programs are too big, or too slow, why don't we just add more memory or a faster processor? If that isn't possible today, then the next generation of processors should be powerful enough to spare us such concerns.
It may seem obvious that, before you can optimize a program, you have to know what is making it inefficient. Of course, if you run out of memory or disk space while executing the program, this determination becomes much simpler. Depending on which language and machine you are using, there may be "profiling" tools available which allow you to determine where your program is spending most of its time. These, of course, are most useful when the problem is CPU time, but even if that is not the problem, you may still be able to find out that, e.g., your program is spending 95% of its time in the disk reading and/or writing routines. This is a valuable clue to where the problem lies.
However, even if no profiler is available for your system, it isn't hard to gather some useful information yourself. One way to do this is to insert a call to a system timer routine (such as clock() in ANSI C) at the beginning of the segment to be timed and another call at the end of the segment and subtract the two times. Depending on the resolution of the timer, the length of the routine, and the speed of your processor, you may have to execute the segment more than once to gather any useful information.
JavaScript Recipes: A Problem-Solution Approach Название: javascript Recipes: A Problem-Solution Approach Автор: Russ Ferguson Издательство: Apress Год: 2017 Страниц: 353 Формат: PDF Размер:...
Computer Systems: A Programmer's Perspective Автор: Randal E. Bryant and David R. O'Hallaron Название: Computer Systems: A Programmer's Perspective Издательство: Prentice Hall Год: 2002 ISBN:...
Информация
Посетители, находящиеся в группе Гости, не могут оставлять комментарии к данной публикации.