小编CsO*_*emf的帖子

EASTL表现

今天我下载并创建了一个Electronic Arts STL实现的示例项目,EA的矢量看起来比标准慢得多.我刚创建了2个向量并上传了100万个项目:

void performance_test(void)
{
    clock_t start;
    clock_t end;


    // EA

    eastl::string strEA = "hello";
    eastl::vector<eastl::string> vec_EA;

    start = clock();
    for (size_t i = 0; i < 1000000; i++)
    {
        vec_EA.push_back(strEA);
    }

    end = clock();
    printf("EA       %f\n", (double(end - start) / 1000));

    // Standard

    std::string strStandard = "hello";
    std::vector<std::string> vec_Standard;

    start = clock();
    for (size_t i = 0; i < 1000000; i++)
    {
        vec_Standard.push_back(strStandard);
    }

    end = clock();
    printf("Standard %f\n", (double(end - start) / 1000));
}
Run Code Online (Sandbox Code Playgroud)

结果是:

  1. EA 0.759000 …

c++ templates stl eastl

12
推荐指数
1
解决办法
8196
查看次数

标签 统计

c++ ×1

eastl ×1

stl ×1

templates ×1