Even within this limited definition of performance, pitfalls abound in trying to benchmark code accurately.
即使在如此狭义的性能定义之下,精确地进行代码基准测试仍然有很多困难。
In fact, if we go look at the benchmark code, we will see that the table is created, populated, and used, but statistics are never updated.
事实上,如果我们看一下基准代码,我们就会发现,该表已被创建、填充、并使用,但是统计信息没有被更新。
The code for these examples is based on the benchmark program I used in the preceding article, with some simplifications.
这些示例的代码是以我在上篇文章中使用的基准程序为基础的,并进行了一些简化。
Toward the end of writing high-performance code, developers often write small benchmark programs to measure the relative performance of one approach against another.
开发人员在以编写高性能代码为目标的时候,常常会编写小的基准程序来度量一种方法相对于另一种方法的性能。
Once the code is in a steady state then the benchmark must run it several times and compute a statistical analysis of the results.
代码达到稳定状态之后,基准必须对这段代码运行多次,然后才能对结果做出有效的统计分析。
To demonstrate the performance cost of using reflection, I prepared a set of benchmark programs for this article (see Resources for a link to the full code).
为了阐述使用反射的性能成本,我为本文准备了一组基准程序(见参考资料,完整代码链接)。
You can change a parameter, a line of code, or a workload item, and rerun your benchmark to get a good measurement of the impact of the change.
您还可以改变参数,某行代码,或者工作负载项,甚至可以重新运行基准测试以获得好的度量结果。
Most native XML databases have tools to benchmark or profile code.
大多数原生xml数据库拥有一些工具来对代码进行基准测试或剖析。
The API for most uses is simple: you supply the code to be benchmarked to a Benchmark constructor.
API的基本用法很简单:把要进行基准测试的代码提供给一个Benchmark构造函数。
So, I avoided simple code like new Benchmark (task), which carries out 60 measurements (by default).
因此,我避免使用newBenchmark (task)这样的简单代码(它在默认情况下执行60次度量)。
The linked article continues with the benchmark results comparing the code before and after the merge, which shows significant speed ups with the Joni code.
Nutter接着给出了合并代码前后的基准测试结果对比,数据显示出Joni代码带来了显著的速度提升。
The test code used to benchmark the speedup provided by the six SPEs available on the PS3 USES the Cell SDK to embed code and to pass data to the SPEs through the EIB.
测试代码对PS 3上的六个SPE提供的加速效果进行基准测试,它使用CellSDK嵌入代码并通过EIB将数据传递给SPE。
Six years later, I run the code in Listing 1 on this modern configuration (which I use for every benchmark result in this article unless I note otherwise).
年后,我在下面的现代配置上运行了清单1中的代码(除非另外说明,本文中的所有基准测试结果都采用这种配置)。
After all the design, code generation or recompiling, and performance tuning, the next critical step to deploying a complex application is that a benchmark phase occur.
在完成所有的设计、代码生成或者重新编译、性能优化之后,部署复杂应用程序的一个关键步骤是进行基准测试。
Unfortunately, that dead-code optimization that makes such short work of your benchmark (possibly optimizing it all away) is not going to do quite as well with code that actually does something.
不幸的是,能够让您的评测工作非常短(可能会把评测完全优化掉)的死代码优化,在处理实际做些工作的代码时,做得就不会那么好了。
When your code is functional and accurate — and seemingly or actually slow — your first step is to quantify, or benchmark, its performance.
当代码正确且能实现相应的功能时,不管其表面上看起来运行缓慢还是实际如此,首先要做的就是对其性能进行测试或基准测试。
The framework is easy to use for most benchmarking needs: just package the target code into some type of task object (either a Callable or Runnable) and then make a single call to the benchmark class.
这个框架很容易满足大多数基准测试需求:只要把目标代码打包成特定类型的任务对象(Callable或Runnable),然后调用benchmark类。
In Listing 1, main defines the code to be benchmarked as a Callable and simply supplies it to a benchmark constructor.
在清单1中,main把要测试的代码定义为Callable,然后提供给Benchmark构造函数。
I have chosen (a bad choice) to not include code to align variables in the benchmark.
我有一个选择(一个坏的选择),在基准测试中,通过不包含代码来对其变量。
The source code available with this article includes a micro-benchmark application, which executes a stack in a tight loop.
本文随附的源代码包含一个微型基准应用程序,它在紧密循环中执行堆栈。
The source code available with this article includes a micro-benchmark application, which executes a stack in a tight loop.
本文随附的源代码包含一个微型基准应用程序,它在紧密循环中执行堆栈。
应用推荐