zoukankan      html  css  js  c++  java
  • 矩阵访问测试

    /*
    *
    *时间:2012年3月9日13:04:00
    *作者:张超
    *Email:uestczhangchao@gmail.com
    */
    
    
    #include <iostream>
    #include <windows.h>
    #include <time.h>
    
    using namespace std;
    
    
    int Mat[1000];
    
    void fun1()
    {
        int *tmp = &Mat[500];
        for (int i=0; i<100000;i++)
        {
            for (int j=0; j<1000;j++)
            {
                *tmp = 333;
            }
        }
    
    
    }
    
    
    void fun2()
    {
        
        for (int i=0; i<100000;i++)
        {
            for (int j=0; j<1000;j++)
            {
                Mat[500]=333;
            }
        }
    }
    
    
    
    int main()
    {
        SYSTEMTIME st1,st2;
        GetSystemTime(&st1);
        fun1();
        GetSystemTime(&st2);
    
        cout << "fun1 running time::" << endl;
        cout << "st1.wSecond:"<<st1.wSecond << " st2.wSecond" << st2.wSecond << endl;
        cout << "st1.wMilliseconds:" << st1.wMilliseconds << " st2.wMilliseconds:" << st2.wMilliseconds << endl;
        cout << "st2.wMilliseconds-st1.wMilliseconds:" << st2.wMilliseconds - st1.wMilliseconds << endl;
        cout << "*************"<< endl;
    
        cout << (((st2.wSecond-st1.wSecond)>0)?(st2.wSecond-st1.wSecond)*1000:0)+(st2.wMilliseconds-st1.wMilliseconds)<<endl;
    
        GetSystemTime(&st1);
        fun2();
        GetSystemTime(&st2);
    
        cout << "fun2 running time::" << endl;
        cout << "st1.wSecond:"<<st1.wSecond << " st2.wSecond:" << st2.wSecond << endl;
        cout << "st1.wMilliseconds:" << st1.wMilliseconds << " st2.wMilliseconds:" << st2.wMilliseconds << endl;
        cout << "st1.wMilliseconds:" << st1.wMilliseconds << " st2.wMilliseconds:" << st2.wMilliseconds << endl;
        cout << "st2.wMilliseconds-st1.wMilliseconds:" << st2.wMilliseconds - st1.wMilliseconds << endl;
        cout << "*************"<< endl;
    
    cout << (((st2.wSecond-st1.wSecond)>0)?(st2.wSecond-st1.wSecond)*1000:0)+(st2.wMilliseconds-st1.wMilliseconds)<<endl;
    
    
        return 0;
    }
  • 相关阅读:
    菜鸟学JS(一)——上传图片之上传前预览图片
    菜鸟学JS(二)——上传图片之上传后查看大图
    FTP文件操作之下载文件
    FTP文件操作之删除文件
    上传图片之上传前判断文件格式与大小
    FTP文件操作之上传文件
    ASP.NET中的几种弹出框提示
    dbo.fn_trace_gettable
    Blocked Process Report
    extended property
  • 原文地址:https://www.cnblogs.com/justinzhang/p/2387435.html
Copyright © 2011-2022 走看看