Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

[core] Convert uses of std::set to std::unordered_set - #6325

Merged
jfirebaugh merged 12 commits into
masterfrom
unorderedquest
Sep 20, 2016
Merged

jfirebaugh merged 12 commits into
masterfrom
unorderedquest

Conversation

@lucaswoj

@lucaswoj lucaswoj commented Sep 13, 2016 •

Copy link
Copy Markdown
Contributor

The std::set collection is ordered. It is less efficient than its std::unordered_set counterpart. This PR converts as many uses of std::set into std::unordered_set as possible.

see #3980

Todo

Uses of std::set

Below is a list of all uses of std::set. We will check of each as it is switched to std::unordered_set or we confirm that it cannot be switched.

Changed ✅

  • ./include/mbgl/storage/network_status.hpp:31: static std::set<util::AsyncTask*> observers; done in ac000d10a301d7e2a7c4dc66d84222e7d319d244
  • ./src/mbgl/algorithm/generate_clip_ids.hpp:20: std::set<CanonicalTileID> children; done in a289d58e346cfb2ef4ffcfe160734d59222fb013
  • ./src/mbgl/algorithm/update_renderables.hpp:24: std::set<UnwrappedTileID> checked; done in de20cd0a8da4edfc899020f24de288339ca4e947
  • ./src/mbgl/annotation/annotation_manager.hpp:76: std::set<std::string> obsoleteShapeAnnotationLayers; done in f1f73f42349
  • ./src/mbgl/annotation/annotation_manager.hpp:77: std::set<AnnotationTile*> tiles; f1f73f42349
  • ./src/mbgl/geometry/glyph_atlas.hpp:49: std::set<uintptr_t> ids; done in abce9d0
  • ./src/mbgl/renderer/painter.cpp:83: const std::set<Source*>& sources = renderData.sources; done in 0d9b495e8042c27816d52034a9709dba33fbd564
  • ./src/mbgl/renderer/render_item.hpp:34: std::set<style::Source*> sources; done in 0d9b495e8042c27816d52034a9709dba33fbd564
  • ./src/mbgl/renderer/symbol_bucket.hpp:130: std::set<GlyphRange> ranges; done in 55bafc5ca55e7c1364e79955a9e8fc60552b6a56
  • ./src/mbgl/sprite/sprite_atlas.hpp:92: std::set<std::string> uninitialized; done in 2b40808a818ef46a0b7bf06863fa424c4ca0e9de
  • ./src/mbgl/storage/network_status.cpp:14:std::set<util::AsyncTask *> NetworkStatus::observers; done in ac000d10a301d7e2a7c4dc66d84222e7d319d244
  • ./src/mbgl/text/collision_tile.cpp:159: std::unordered_map<std::string, std::set<std::size_t>> sourceLayerFeatures; done in 11e109599d947420e2fa8e1a9249bd29341773ff
  • ./src/mbgl/text/glyph_store.cpp:31:bool GlyphStore::hasGlyphRanges(const FontStack& fontStack, const std::set<GlyphRange>& glyphRanges) { done in 55bafc5ca55e7c1364e79955a9e8fc60552b6a56
  • ./src/mbgl/text/glyph_store.hpp:37: bool hasGlyphRanges(const FontStack&, const std::set<GlyphRange>&); done in 55bafc5
  • ./src/mbgl/tile/tile_worker.cpp:58: std::set<std::string> parsed; done in ecbb4b26e11a204de46be1cf638dc6ba505fad4c
  • ./src/mbgl/style/update_batch.hpp:11: std::set<std::string> sourceIDs; done in 3f0a3752410cca620ee92528e2690b6086ddcb9a
  • ./platform/default/mbgl/storage/offline_download.hpp done in 0ca2c61
  • ./src/mbgl/style/source_impl.cpp:108: std::set<OverscaledTileID> retain; done in 3a65ea3

Won't Change 🙅

@mention-bot

Copy link
Copy Markdown

@lucaswoj, thanks for your PR! By analyzing this pull request, we identified @jfirebaugh, @tmpsantos and @ansis to be potential reviewers.

@lucaswoj lucaswoj changed the title Convert uses of std::set to std::unordered_set [core] Convert uses of std::set to std::unordered_set Sep 13, 2016
@lucaswoj
lucaswoj force-pushed the unorderedquest branch 2 times, most recently from 6f71e9f to 3f0a375 Compare September 13, 2016 23:18
@lucaswoj lucaswoj added refactor ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold Core The cross-platform C++ core, aka mbgl performance Speed, stability, CPU usage, memory usage, or power usage labels Sep 13, 2016
@lucaswoj

Copy link
Copy Markdown
Contributor Author

Ready for 👀 @jfirebaugh @tmpsantos @bleege

@jfirebaugh jfirebaugh self-assigned this Sep 19, 2016
@jfirebaugh jfirebaugh removed the ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold label Sep 19, 2016
@jfirebaugh
jfirebaugh merged commit 37cb2bd into master Sep 20, 2016
@jfirebaugh
jfirebaugh deleted the unorderedquest branch September 20, 2016 00:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Core The cross-platform C++ core, aka mbgl performance Speed, stability, CPU usage, memory usage, or power usage refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants