我编写了计算数组约简和的简单C++代码,但是使用OpenMP约简程序工作得很慢。程序有两个变体:一个是最简单的和,另一个是复杂数学函数的和.在代码中,复杂变体被注释。
#include <iostream>
#include <omp.h>
#include <math.h>
using namespace std;
#define N 100000000
#define NUM_THREADS 4
int main() {
int *arr = new int[N];
for (int i = 0; i < N; i++) {
公共类AlgorithmC{
Public class AlgorithmC{
public static void main(String[] args) {
System.out.println("Table of n and the execution time with the Algorithm c:");
for (long n = 1; n <= 10000000;n=n*10) {
long startTime = System.currentTimeMillis();
我有一个类,在该类中我注册了一个关闭函数,如下所示
class test{
function __construct() {
$self = $this;
$shutdown = function () use (&$self) {
$self->shutdown();
};
register_shutdown_function($shutdown);
}
public function shutdown()
{
echo 'shutd
我想测试一下我的项目工作起来有多快。如果有可能标记我的函数慢的地方,那就太好了,这样我就可以改变我的代码来提高性能。我正在使用Microsoft Visual Studio 2012,我知道有一个内置的测试工具,但我真的不知道在哪里可以找到它,可能也不知道如何使用它。如果有人能帮我解决这个问题,那就太好了。