我正在寻找软件来进行基准测试,分析,代码和应用程序的性能.像英特尔VTune这样的东西.
任何人都可以给我一些名字,免费或付费,针对c#apps.
谢谢
我想做一些微基准测试,并尝试做正确的.不幸的是,动态频率调整使得基准测试非常不可靠.
有没有办法以编程方式(C++,Windows)找出是否启用了动态频率调整?如果,这可以在程序中禁用吗?
香港专业教育学院曾试图在实际基准测试发生前使用100%CPU的预热阶段,但事实证明这也是不可靠的.
更新:即使我在BIOS中禁用SpeedStep,cpu-z显示频率在1995和2826 GHz之间变化
对于任务,我们需要使用不同的优化和参数对我们的实现进行基准测试.有没有一种可行的方法来对linux命令行(我知道时间)上的小程序进行基准测试,使用不同的参数,这样可以将时间数据作为CSV或类似的东西?输出可能是这样的:
Implementation Time
A 23s
B with -O3 2Threads 15s
B with -O3 4Threads 10s
Run Code Online (Sandbox Code Playgroud)
我很确定我在一些教授幻灯片上看到过类似的东西,但是我不记得是谁或者什么时候......
在我们的一个应用程序中,我们需要保存一些简单的表格数据,我们需要能够在其中一个列上执行用户端自动完成.
我们提出的初始解决方案是将MySQL与Solr连接起来实现这一目标(MySQL保存数据,Solr只保留标记化列并返回id作为结果).但最近发生了一些不愉快的事情(开发人员开始在Solr中存储一些数据,因为MySQL表及其上完成的操作不是Solr无法提供的),我们认为也许我们可以将它们合并在一起并消除其中的一个.
所以我们不得不:(1)将所有数据移到Solr(2)使用MySQL进行自动完成
(1)听起来很糟糕,所以我给了它一个镜头(2),我开始将这个单列的数据加载到MySQL,禁用MySQL和Solr上的所有缓存,编写了一个能够执行非常类似查询的小型webapp [1 ]在两个数据库上,并在本地和类似环境中针对这两种情况启动了一些JMeter方案.结果显示Solr有2.5-3.5倍的优势,但是,我认为结果可能完全错误且容易出错.
那么,你会建议什么:
感谢任何线索.
SELECT column FROM table WHERE column LIKE 'USER-INPUT%'关于MySQL和column:"USER-INPUT"Solr的[1] .
我做了一个简单的测试,我知道C++更快但我的测试结果不切实际.
C++代码是:
#include <stdio.h>
#include <windows.h>
unsigned long long s(unsigned long long n)
{
unsigned long long s = 0;
for (unsigned long long i = 0; i < n; i++)
s += i;
return s;
}
int main()
{
LARGE_INTEGER freq, start, end;
QueryPerformanceFrequency(&freq);
QueryPerformanceCounter(&start);
printf("%llu\n", s(1000000000));
QueryPerformanceCounter(&end);
double d = (double) (end.QuadPart - start.QuadPart) / freq.QuadPart * 1000.0;
printf("Delta: %f\n", d);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
Java代码是:
public class JavaApplication5 {
public static long s(long n) {
long s = …Run Code Online (Sandbox Code Playgroud) 我正在为我的硕士论文进行性能测试,而且我的Symfony2简单应用程序的性能非常差.它是简单的应用程序,一个查询和一些数学.
命令测试结果:
ab -c10 -t60 http://sf2.cities.localhost/app.php
Server Software: Apache/2.2.20
Server Hostname: sf2.cities.localhost
Server Port: 80
Document Path: /app.php
Document Length: 2035 bytes
Concurrency Level: 10
Time taken for tests: 60.162 seconds
Complete requests: 217
Failed requests: 68
(Connect: 0, Receive: 0, Length: 68, Exceptions: 0)
Write errors: 0
Non-2xx responses: 68
Total transferred: 393876 bytes
HTML transferred: 321102 bytes
Requests per second: 3.61 [#/sec] (mean)
Time per request: 2772.458 [ms] (mean)
Time per request: 277.246 [ms] (mean, across all concurrent …Run Code Online (Sandbox Code Playgroud) 我们有一个简单的单元测试作为我们的性能测试套件的一部分,我们用它来验证基本系统是否合理并在我们开始测试代码之前执行.这样我们通常会验证机器是否适合运行实际的性能测试.
当我们使用此测试比较Java 6和Java 7时,Java 7需要相当长的时间才能执行!我们看到Java 6平均为22秒,Java 7平均为24秒.测试只计算fibonacci,因此在这里只有单个线程中的字节码执行应该与I/O或其他任何东西相关.
目前我们使用带有或不带"-server"的Windows上的默认设置运行它,使用32位和64位JVM,所有运行都表明Java 7的类似降级.
哪些调优选项可能适合尝试将Java 7与Java 6相匹配?
public class BaseLinePerformance {
@Before
public void setup() throws Exception{
fib(46);
}
@Test
public void testBaseLine() throws Exception {
long start = System.currentTimeMillis();
fib(46);
fib(46);
System.out.println("Time: " + (System.currentTimeMillis() - start));
}
public static void fib(final int n) throws Exception {
for (int i = 0; i < n; i++) {
System.out.println("fib(" + i + ") = " + fib2(i));
}
}
public static int fib2(final int n) …Run Code Online (Sandbox Code Playgroud) 有一个错误,JMH没有把我的班级提升到基准.
package com.stecurran.jmh.entry;
import org.openjdk.jmh.Main;
public class JmhRunner {
private static final String TEST = "com.stecurra.benchmark.strategy.EventRunner";
public static void main(String[] args) {
Main.main(getArguments(TEST, 5, 5000, 1));
}
private static String[] getArguments(String className, int nRuns, int runForMilliseconds, int nThreads) {
return new String[] { className, "-i", "" + nRuns, "-r", runForMilliseconds + "ms", "-t", "" + nThreads, "-w", "5000ms", "-wi", "3", "-v" };
}
}
Run Code Online (Sandbox Code Playgroud)
EventRunner包含的位置:
package com.stecurra.benchmark.strategy;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.GenerateMicroBenchmark;
import org.openjdk.jmh.annotations.Mode;
@BenchmarkMode(Mode.AverageTime)
public class EventRunner {
@GenerateMicroBenchmark
public …Run Code Online (Sandbox Code Playgroud) 我很难理解这个基准测试的进展情况.我想测量我的样本类的StringBand工作方式StringBuilder.这个想法StringBand是连接字符串,而toString()不是连接字符串append().
这是StringBand源 - 剥离基准:
public class StringBandSimple {
private String[] array;
private int index;
private int length;
public StringBandSimple(int initialCapacity) {
array = new String[initialCapacity];
}
public StringBandSimple append(String s) {
if (s == null) {
s = StringPool.NULL;
}
if (index >= array.length) {
//expandCapacity();
}
array[index++] = s;
length += s.length();
return this;
}
public String toString() {
if (index == 0) {
return StringPool.EMPTY; …Run Code Online (Sandbox Code Playgroud) 我view对朱莉娅对稀疏矩阵的行为感到困惑不解:
using LinearAlgebra, SparseArrays, BenchmarkTools
v = SparseVector(1000, [212,554,873], [.3, .4, .3]);
A = sparse(diagm(rand(1000))); # same effect observed for non-diag matrix
B = view(A, :, :);
julia> @btime A*v;
1.536 ?s (4 allocations: 23.84 KiB)
julia> @btime B*v;
11.557 ms (5 allocations: 288 bytes)
Run Code Online (Sandbox Code Playgroud)
B*v似乎占用的内存少得多,但比慢8000倍A*v。这是怎么回事,是什么导致这些性能差异?