diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 3dcd7aab57..2056044a4b 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -8,8 +8,5 @@ set_target_properties(scribe PROPERTIES FOLDER "Tools") add_subdirectory(udt-test) set_target_properties(udt-test PROPERTIES FOLDER "Tools") -add_subdirectory(container-profile) -set_target_properties(container-profile PROPERTIES FOLDER "Tools") - add_subdirectory(vhacd-util) set_target_properties(vhacd-util PROPERTIES FOLDER "Tools") diff --git a/tools/container-profile/CMakeLists.txt b/tools/container-profile/CMakeLists.txt deleted file mode 100644 index 9c0adb99f2..0000000000 --- a/tools/container-profile/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set(TARGET_NAME container-profile) -setup_hifi_project() - -link_hifi_libraries(networking) \ No newline at end of file diff --git a/tools/container-profile/src/main.cpp b/tools/container-profile/src/main.cpp deleted file mode 100644 index 3cde3b2a23..0000000000 --- a/tools/container-profile/src/main.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// -// main.cpp -// tools/container-profile/src -// -// Created by Stephen Birarda on 8/18/15. -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html - -#include -#include -#include -#include -#include - -#include - -using namespace std::chrono; - -int main(int argc, char* argv[]) { - static const int NUM_ELEMENTS = 50; - - std::random_device rd; - std::mt19937 generator(rd()); - std::uniform_int_distribution<> ipDistribution(1, UINT32_MAX); - std::uniform_int_distribution<> portDistribution(1, UINT16_MAX); - - // from 1 to NUM_ELEMENTS, create a vector and unordered map with that many elements and compare how long it takes to pull the last value - for (int i = 1; i <= NUM_ELEMENTS; ++i) { - // create our vector with i elements - std::vector> vectorElements(i); - - // create our unordered map with i elements - std::unordered_map hashElements; - - HifiSockAddr lastAddress; - - // fill the structures with HifiSockAddr - for (int j = 0; j < i; ++j) { - // create a random IP address - quint32 randomNumber = ipDistribution(generator); - quint32 randomIP = (randomNumber >> 24 & 0xFF) << 24 | - (randomNumber >> 16 & 0xFF) << 16 | - (randomNumber >> 8 & 0xFF) << 8 | - (randomNumber & 0xFF); - - HifiSockAddr randomAddress(QHostAddress(randomIP), portDistribution(generator)); - - vectorElements.push_back({ randomAddress, 12 }); - hashElements.insert({ randomAddress, 12 }); - - if (j == i - 1) { - // this is the last element - store it for lookup purposes - lastAddress = randomAddress; - } - } - - // time how long it takes to get the value for the key lastAddress, for each container - auto before = high_resolution_clock::now(); - int vectorResult; - - for (auto& vi : vectorElements) { - if (vi.first == lastAddress) { - vectorResult = vi.second;; - break; - } - } - - auto vectorDuration = duration_cast(high_resolution_clock::now() - before); - - Q_UNUSED(vectorResult); - - before = high_resolution_clock::now(); - auto mi = hashElements.find(lastAddress); - int mapResult = mi->second; - auto mapDuration = duration_cast(high_resolution_clock::now() - before); - - Q_UNUSED(mapResult); - - qDebug() << i << QString("v: %1ns").arg(vectorDuration.count()) << QString("m: %2ns").arg(mapDuration.count()); - } -} -