본문으로 바로가기

FBVector

category 블로그 (Blog)/개발로그 (Devlogs) 2024. 3. 8. 16:47

페이스북에서 공개한 FBVector.. (https://github.com/facebook/folly/blob/master/folly/docs/FBVector.md)

 

FBVector는 folly의 일부분으로 std::vector 를 대체하기위한 용도. (folly는 C++의 std나 boost 라이브러리의 일부분을 개선하거나 대체 용도로 개발된 클래스 모음.)

일단 테스트해보니.. 속도면에서 상당한 개선이..

{
    std::chrono::system_clock::time_point start = std::chrono::system_clock::now();
 
    folly::fbvector<unsigned int> vec;
    for(int i=0; i<1000000000; i++) {
        vec.push_back(i);
    }
 
    std::chrono::duration<double> sec = std::chrono::system_clock::now() - start;
    std::cout << "FBVector: Time passed (sec) : " << sec.count() << " seconds" << std::endl;
 
    std::cout << "Press any key to next test." << std::endl;
    getchar();
     
    vec.clear();
    vec.shrink_to_fit();
}
 
{
    std::chrono::system_clock::time_point start = std::chrono::system_clock::now();
 
    std::vector<unsigned int> vec;
    for(int i=0; i<1000000000; i++) {
        vec.push_back(i);
    }
 
    std::chrono::duration<double> sec = std::chrono::system_clock::now() - start;
    std::cout << "Vector: Time passed (sec) : " << sec.count() << " seconds" << std::endl;
 
    std::cout << "Press any key to exit." << std::endl;
    getchar();
 
    vec.clear();
    vec.shrink_to_fit();
}


실행..

FBVector: Time passed (sec) : 9.05379 seconds
Press any key to next test.
 
Vector: Time passed (sec) : 16.3373 seconds
Press any key to exit.

 

'블로그 (Blog) > 개발로그 (Devlogs)' 카테고리의 다른 글

Single-pass Wireframe Rendering  (0) 2024.03.08
ccache  (0) 2024.03.08
ffmpeg 프레임 추출 예제  (0) 2024.03.08
Python 무설치 버전  (0) 2024.03.08
GNU utilities for Win32  (0) 2024.03.08