以我的经验来看,导致程序运行速度慢得罪魁祸首可能就是某个内部或嵌套循环,也可能是对第三方库函数的调用。
In my experience, it will usually be a particular inner or nested loop, or a call to some third party library methods, which is the main culprit for running the program slow.
对标准程序库而言,有很多程序库函数在固定的对象中返回值,总是重复使用同一对象,这就使得那些函数不可重入。
As with the standard library, there can be many library functions that return values in fixed objects, always reusing the same objects, which causes the functions to be non-reentrant.
当开发一个应用程序或者是其他的处于用户空间的程序时,开发者必须考虑其他人写的代码----操作系统,库函数,还有其他程序,等等。
When developing an application or other userspace program, the developer has to take into consideration the code written by others: the operating system, the libraries, other programs, etc.
Same way that I have multiplication or division as a primitive, functions are going to give me, or somebody else who wrote them for me as part of a library, a new primitive that I'm going to be able to use.
我在用乘法或者除法当做原语,这些函数,或者别人写程序库中的函数,将会给我返回一个,我能使用的新原语。
But long story short, if I want to use a function called sleep, -- the reason I, the programmer, knew to use that library -- -- that header at the top -- because it told me to in this little synopsis.
但长话短说,如果我想要用一个叫做sleep的功能,我作为程序员知道使用那个函数库-,上面的标题-,因为在这个小的大纲中它告诉我。
应用推荐