Created
January 16, 2012 23:21
-
-
Save mosra/1623547 to your computer and use it in GitHub Desktop.
Tipsify benchmark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
queue<unsigned int> cache; | |
unordered_set<unsigned int> map; | |
size_t misses = 0; | |
size_t maxSize = 24; | |
for(unsigned int index: builder.indices()) { | |
if(map.find(index) != map.end()) continue; | |
/* Not in cache */ | |
++misses; | |
/* Erase last element from cache */ | |
if(cache.size() == maxSize) { | |
map.erase(cache.front()); | |
cache.pop(); | |
} | |
/* Put new element to cache */ | |
cache.push(index); | |
map.insert(index); | |
} | |
Debug() << "Cache misses:" << misses << '/' << builder.indexCount(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buddha: | |
with: 66 853 / 300 000 (22%) | |
without: 230 792 / 300 000 (77%) | |
dragon: | |
with: 65 995 / 300 000 (22%) | |
without: 223 617 / 300 000 (75%) | |
bunny: | |
with: 43 578 / 208 998 (21%) | |
without: 143 718 / 208 998 (69%) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment