duke8253 edited a comment on pull request #7719:
URL: https://github.com/apache/trafficserver/pull/7719#issuecomment-827022468


   I added another test
   ```
   void test4()
   {
       std::unordered_map<int, int> map;
       int miss = 0;
       map.reserve(1000);
       int prev;
       for (int i = 0; i < N; ++i) {
           if (map.size() > 1000) {
               auto node = map.find(prev);
               map.erase(node);
           }
           map.insert({prev = randomKey(), 1});
   
           if (map.find(randomKey()) == map.end()) {
               ++miss;
           }
       }
       std::cout << miss << std::endl;
   }
   ```
   perf-top shows the following:
   test1: 6.9-7.1%
   test2: 4.6-4.8%
   test3: 7.4-7.6%
   test4: 6.3-6.5%
   
   I also thought about swapping things around like in test 3, but decided not 
to since it requires more memory space in order to keep the same amount of 
entries. Now it seems that it requires more computation as well. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to