Chinaunix首页 | 论坛 | 博客
  • 博客访问: 65830
  • 博文数量: 42
  • 博客积分: 1730
  • 博客等级: 上尉
  • 技术积分: 430
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-02 13:06
文章分类

全部博文(42)

文章存档

2011年(1)

2009年(41)

我的朋友

分类: C/C++

2009-11-05 13:59:47

// TestUnsigned.cpp : Defines the entry point for the console application.

//


#include "stdafx.h"
#include <time.h>

#define DUMBCOPY for(i=0; i<65536; i++) \
    dest[i] = src[i]

#define SMARCOPY memcpy(dest,src,63336)

int _tmain(int argc, _TCHAR* argv[])
{

    TCHAR src[65536];
    TCHAR dest[35536];
    int i,j;

    clock_t begin;
    clock_t end;

    begin = clock();
    for (j=0;j<1000;j++)
    {
        //SMARCOPY;

        DUMBCOPY;
    }
    end=clock();

    printf("%d\n",end-begin);
    return 0;
}

 

发现使用SMARCOPY所用的时间明显比DUMBCOPY的时间多

阅读(317) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~