|
|
Created:
4 years, 2 months ago by alex clarke (OOO till 29th) Modified:
4 years, 2 months ago CC:
chromium-reviews, blink-reviews, blink-reviews-wtf_chromium.org, scheduler-bugs_chromium.org, Mikhail Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionIntroduce a FlatMap and FlatSet into WTF
Cache friendly data structures which outperform std::map<> and std::set<>
for small or static datasets. This patch delivers a ~12% improvement
to TaskQueueManagerPerfTest.RunTenThousandDelayedTasks_ThirtyTwoQueues.
Measured on a z620 with the following steps taken to reduce noise:
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
taskset 1 out_linux/Release/blink_platform_perftests --gtest_filter=TaskQueueManagerPerfTest.RunTenThousandDelayedTasks_ThirtyTwoQueues
Data: https://docs.google.com/spreadsheets/d/1qwsFxSay47rnd3YGs-TOVDxjjwNZKyOuIW8zOKWULVg/edit#gid=0
BUG=
Patch Set 1 #Patch Set 2 : Add mising files #Patch Set 3 : Chromium style #Patch Set 4 : Fix compile #Patch Set 5 : Rebased #Patch Set 6 : Fix compile #
Total comments: 12
Patch Set 7 : Fix bug where search_step_size_ became zero #Patch Set 8 : A first try at a perftest #Patch Set 9 : Fix power of two check #Patch Set 10 : Fix some issues with the perf test #Patch Set 11 : Add missing ostream override #Messages
Total messages: 82 (68 generated)
The CQ bit was checked by alexclarke@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: android_n5x_swarming_rel on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_n5x_...) linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_androi...) mac_chromium_compile_dbg_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_comp...) mac_chromium_rel_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_...)
The CQ bit was checked by alexclarke@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: mac_chromium_compile_dbg_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_comp...)
Description was changed from ========== Introduce a FlatMap and FlatSet into WTF Cache friendly datasructures which outperform std::map<> and std::set<> for small datasets. BUG= ========== to ========== Introduce a FlatMap and FlatSet into WTF Cache friendly data structures which outperform std::map<> and std::set<> for small datasets. On the BUG= ==========
The CQ bit was checked by alexclarke@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: cast_shell_linux on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/cast_shell_linu...) chromeos_amd64-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_amd64-...) linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...) linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
Description was changed from ========== Introduce a FlatMap and FlatSet into WTF Cache friendly data structures which outperform std::map<> and std::set<> for small datasets. On the BUG= ========== to ========== Introduce a FlatMap and FlatSet into WTF Cache friendly data structures which outperform std::map<> and std::set<> for small or static datasets. This patch delivers a ~12% improvement to TaskQueueManagerPerfTest.RunTenThousandDelayedTasks_ThirtyTwoQueues. Measured on a z620 with echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor taskset 1 out_linux/Release/blink_platform_perftests --gtest_filter=TaskQueueManagerPerfTest.RunTenThousandDelayedTasks_ThirtyTwoQueues https://docs.google.com/spreadsheets/d/1qwsFxSay47rnd3YGs-TOVDxjjwNZKyOuIW8zO... BUG= ==========
Description was changed from ========== Introduce a FlatMap and FlatSet into WTF Cache friendly data structures which outperform std::map<> and std::set<> for small or static datasets. This patch delivers a ~12% improvement to TaskQueueManagerPerfTest.RunTenThousandDelayedTasks_ThirtyTwoQueues. Measured on a z620 with echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor taskset 1 out_linux/Release/blink_platform_perftests --gtest_filter=TaskQueueManagerPerfTest.RunTenThousandDelayedTasks_ThirtyTwoQueues https://docs.google.com/spreadsheets/d/1qwsFxSay47rnd3YGs-TOVDxjjwNZKyOuIW8zO... BUG= ========== to ========== Introduce a FlatMap and FlatSet into WTF Cache friendly data structures which outperform std::map<> and std::set<> for small or static datasets. This patch delivers a ~12% improvement to TaskQueueManagerPerfTest.RunTenThousandDelayedTasks_ThirtyTwoQueues. Measured on a z620 with the following steps taken to reduce noise: echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor taskset 1 out_linux/Release/blink_platform_perftests --gtest_filter=TaskQueueManagerPerfTest.RunTenThousandDelayedTasks_ThirtyTwoQueues https://docs.google.com/spreadsheets/d/1qwsFxSay47rnd3YGs-TOVDxjjwNZKyOuIW8zO... BUG= ==========
The CQ bit was checked by alexclarke@chromium.org to run a CQ dry run
alexclarke@chromium.org changed reviewers: + skyostil@chromium.org
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: chromeos_amd64-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_amd64-...)
The CQ bit was checked by alexclarke@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: cast_shell_android on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/cast_shell_a...) linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
Patchset #6 (id:100001) has been deleted
The CQ bit was checked by alexclarke@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
alexclarke@chromium.org changed reviewers: + haraken@chromium.org
+haraken
Description was changed from ========== Introduce a FlatMap and FlatSet into WTF Cache friendly data structures which outperform std::map<> and std::set<> for small or static datasets. This patch delivers a ~12% improvement to TaskQueueManagerPerfTest.RunTenThousandDelayedTasks_ThirtyTwoQueues. Measured on a z620 with the following steps taken to reduce noise: echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor taskset 1 out_linux/Release/blink_platform_perftests --gtest_filter=TaskQueueManagerPerfTest.RunTenThousandDelayedTasks_ThirtyTwoQueues https://docs.google.com/spreadsheets/d/1qwsFxSay47rnd3YGs-TOVDxjjwNZKyOuIW8zO... BUG= ========== to ========== Introduce a FlatMap and FlatSet into WTF Cache friendly data structures which outperform std::map<> and std::set<> for small or static datasets. This patch delivers a ~12% improvement to TaskQueueManagerPerfTest.RunTenThousandDelayedTasks_ThirtyTwoQueues. Measured on a z620 with the following steps taken to reduce noise: echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor taskset 1 out_linux/Release/blink_platform_perftests --gtest_filter=TaskQueueManagerPerfTest.RunTenThousandDelayedTasks_ThirtyTwoQueues Data: https://docs.google.com/spreadsheets/d/1qwsFxSay47rnd3YGs-TOVDxjjwNZKyOuIW8zO... BUG= ==========
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
BTW I think I'll split this up into two patches, and I'll try and add a comparative perf test vs std::map and WTF::HashMap.
haraken@chromium.org changed reviewers: + yutak@chromium.org
I want to hear an opinion of yutak@, who did a lot of investigations about HashTable's performance. I'm personally slightly negative about introducing FlatMap/FlatSet. I agree that it will significantly speed up small hash tables, but in common cases we cannot statically estimate how many values will be added to the hash tables. If people start (mis-)using FlatMap/FlatSet for hash tables that they think would be small but actually become large, it will end up with regressing performance. My preference would be to optimize the implementation of the existing HashTable so that it uses a ring buffer until the table size exceeds some threshold. That way we can not only avoid introducing new primitive types but also prevent people from mis-using FlatMap/FlatSet on hash tables where FlatMap/FlatSet shouldn't be used. I think yutak@ did some experiment around the idea.
First just let me check one thing: is this conceptually similar to google3's dense_hash_map? google3's has some overhead on memory usage, but I'm not sure if yours is the same. I certainly have considered introducing dense_hash_map equivalent in Blink, but I did not think about that very deeply. There's certainly room for optimization for small tables according to our usage pattern. I'm especially curious about overhead/benefit balance.
Looks pretty neat. I'll leave it up to you guys to decide if this makes sense in the grander scheme of things. It might also be worth having the discussion about how this compares to base::SmallMap[1] and whether it is feasible to optimize that instead? [1] https://cs.chromium.org/chromium/src/base/containers/small_map.h?q=base+small... https://codereview.chromium.org/2396533004/diff/120001/third_party/WebKit/Sou... File third_party/WebKit/Source/wtf/FlatMap.h (right): https://codereview.chromium.org/2396533004/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/wtf/FlatMap.h:23: // a low number of Elements or it doesn't change much. It'd be useful to quantify what "low" means. https://codereview.chromium.org/2396533004/diff/120001/third_party/WebKit/Sou... File third_party/WebKit/Source/wtf/FlatSet.h (right): https://codereview.chromium.org/2396533004/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/wtf/FlatSet.h:65: DISALLOW_COPY_AND_ASSIGN(FlatSet); STL containers are copyable and assignable -- is there a reason to be different here? https://codereview.chromium.org/2396533004/diff/120001/third_party/WebKit/Sou... File third_party/WebKit/Source/wtf/FlatTable.h (right): https://codereview.chromium.org/2396533004/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/wtf/FlatTable.h:63: ring_buffer_.resize(4); Should we make this a named constant? https://codereview.chromium.org/2396533004/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/wtf/FlatTable.h:141: // O(log n + n / 2) Maybe document the return value? https://codereview.chromium.org/2396533004/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/wtf/FlatTable.h:163: if (empty()) { DCHECK that value is actually unique? Edit: I guess InsertUniqueImpl kinda does that already. https://codereview.chromium.org/2396533004/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/wtf/FlatTable.h:253: size_t InsertUniqueImpl(value_type value) { Maybe the great renaming will fix this but I find it a bit jarring that we're 50% chrome/blink style here with names :) https://codereview.chromium.org/2396533004/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/wtf/FlatTable.h:323: void ComputeModulusMask() { modulus_mask_ = ring_buffer_.size() - 1; } DCHECK that this is 2^n-1?
The CQ bit was checked by alexclarke@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by alexclarke@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
On 2016/10/07 06:51:18, haraken wrote: > I want to hear an opinion of yutak@, who did a lot of investigations about > HashTable's performance. > > I'm personally slightly negative about introducing FlatMap/FlatSet. I agree that > it will significantly speed up small hash tables, but in common cases we cannot > statically estimate how many values will be added to the hash tables. If people > start (mis-)using FlatMap/FlatSet for hash tables that they think would be small > but actually become large, it will end up with regressing performance. > > My preference would be to optimize the implementation of the existing HashTable > so that it uses a ring buffer until the table size exceeds some threshold. That > way we can not only avoid introducing new primitive types but also prevent > people from mis-using FlatMap/FlatSet on hash tables where FlatMap/FlatSet > shouldn't be used. I think yutak@ did some experiment around the idea. That might be interesting to do as well, but for the scheduler use cases HashSet doesn't help because it's unordered. FlatMap/FlatSet are associative containers (i.e. they're sorted) so finding and extracting the lowest value is O(1).
On 2016/10/07 12:02:32, alex clarke wrote: > On 2016/10/07 06:51:18, haraken wrote: > > I want to hear an opinion of yutak@, who did a lot of investigations about > > HashTable's performance. > > > > I'm personally slightly negative about introducing FlatMap/FlatSet. I agree > that > > it will significantly speed up small hash tables, but in common cases we > cannot > > statically estimate how many values will be added to the hash tables. If > people > > start (mis-)using FlatMap/FlatSet for hash tables that they think would be > small > > but actually become large, it will end up with regressing performance. > > > > My preference would be to optimize the implementation of the existing > HashTable > > so that it uses a ring buffer until the table size exceeds some threshold. > That > > way we can not only avoid introducing new primitive types but also prevent > > people from mis-using FlatMap/FlatSet on hash tables where FlatMap/FlatSet > > shouldn't be used. I think yutak@ did some experiment around the idea. > > That might be interesting to do as well, but for the scheduler use cases HashSet > doesn't help because it's unordered. > > FlatMap/FlatSet are associative containers (i.e. they're sorted) so finding and > extracting the lowest value is O(1). Yeah, makes sense. Maybe it's better to discuss this in platform-architecture-dev@ including wtf/ and base/ experts.
On 2016/10/07 12:07:36, haraken wrote: > On 2016/10/07 12:02:32, alex clarke wrote: > > On 2016/10/07 06:51:18, haraken wrote: > > > I want to hear an opinion of yutak@, who did a lot of investigations about > > > HashTable's performance. > > > > > > I'm personally slightly negative about introducing FlatMap/FlatSet. I agree > > that > > > it will significantly speed up small hash tables, but in common cases we > > cannot > > > statically estimate how many values will be added to the hash tables. If > > people > > > start (mis-)using FlatMap/FlatSet for hash tables that they think would be > > small > > > but actually become large, it will end up with regressing performance. > > > > > > My preference would be to optimize the implementation of the existing > > HashTable > > > so that it uses a ring buffer until the table size exceeds some threshold. > > That > > > way we can not only avoid introducing new primitive types but also prevent > > > people from mis-using FlatMap/FlatSet on hash tables where FlatMap/FlatSet > > > shouldn't be used. I think yutak@ did some experiment around the idea. > > > > That might be interesting to do as well, but for the scheduler use cases > HashSet > > doesn't help because it's unordered. > > > > FlatMap/FlatSet are associative containers (i.e. they're sorted) so finding > and > > extracting the lowest value is O(1). > > Yeah, makes sense. Maybe it's better to discuss this in > platform-architecture-dev@ including wtf/ and base/ experts. Sure. I'll write some more perf tests so we can understand where std::map<> and wtf::HashMap beat it and then loop them in.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: chromeos_x86-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_x86-ge...)
On 2016/10/07 07:46:59, Yuta Kitamura wrote: > First just let me check one thing: is this conceptually > similar to google3's dense_hash_map? google3's has some > overhead on memory usage, but I'm not sure if yours is > the same. Not seen dense_hash_map before, that's quite interesting. This is different it's just a sorted ring buffer. > > I certainly have considered introducing dense_hash_map > equivalent in Blink, but I did not think about that > very deeply. There's certainly room for optimization > for small tables according to our usage pattern. I'm > especially curious about overhead/benefit balance. It should be possible to run some microbenchamarks.
Patchset #8 (id:160001) has been deleted
The CQ bit was checked by alexclarke@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: cast_shell_android on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/cast_shell_a...)
OK let me take a look next week. (Monday is a national holiday in Japan, so I'll work on this on next Tuesday.) Currently, I feel it makes sense to have a container like this in WTF. Will think about this next week.
Patchset #8 (id:180001) has been deleted
Patchset #7 (id:140001) has been deleted
The CQ bit was checked by alexclarke@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: cast_shell_linux on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/cast_shell_linu...)
Patchset #8 (id:220001) has been deleted
The CQ bit was checked by alexclarke@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presub...)
The CQ bit was checked by alexclarke@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presub...)
The CQ bit was checked by alexclarke@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presub...)
On 2016/10/07 12:32:22, Yuta Kitamura wrote: > OK let me take a look next week. (Monday is a national holiday > in Japan, so I'll work on this on next Tuesday.) > > Currently, I feel it makes sense to have a container like > this in WTF. Will think about this next week. Some initial benchmarks: https://docs.google.com/spreadsheets/d/1kQTss_EzfUpNm8hwHAJFPX3l4ej9HCrbOL8xj... For the use case I'm interested in for the scheduler, the FlatSet is significantly faster than std::set for realistic set sizes. Generally WTF::HashSet is the fastest although for very small sets (<10) FlatSet beats it sometimes. Note the graphs are all log scale which understates the differences a little. I wanted to try boost::flat_set but we don't seem to have that readily available, it seems to be quite a complex algorithm so it's anyone's guess how that actually performs in reality. A couple of criticisms of these benchmarks: 1. The set sizes being a power of 2 is likely bad for FlatSet since the array has only just grown 2. The cache is not flushed which skews things.
On 2016/10/10 18:27:09, alex clarke wrote: > On 2016/10/07 12:32:22, Yuta Kitamura wrote: > > OK let me take a look next week. (Monday is a national holiday > > in Japan, so I'll work on this on next Tuesday.) > > > > Currently, I feel it makes sense to have a container like > > this in WTF. Will think about this next week. > > Some initial benchmarks: > https://docs.google.com/spreadsheets/d/1kQTss_EzfUpNm8hwHAJFPX3l4ej9HCrbOL8xj... > > For the use case I'm interested in for the scheduler, the FlatSet is > significantly faster than std::set for realistic set sizes. > > Generally WTF::HashSet is the fastest although for very small sets (<10) FlatSet > beats it sometimes. > > Note the graphs are all log scale which understates the differences a little. > > I wanted to try boost::flat_set but we don't seem to have that readily > available, it seems to be quite a complex algorithm so it's anyone's guess how > that actually performs in reality. > > A couple of criticisms of these benchmarks: > > 1. The set sizes being a power of 2 is likely bad for FlatSet since the array > has only just grown > 2. The cache is not flushed which skews things. Thanks for the performance results! I'd suggest moving further discussions to platform-architecture-dev@.
The CQ bit was checked by alexclarke@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: android_arm64_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_arm6...)
Lets close this for now https://codereview.chromium.org/2396533004/diff/120001/third_party/WebKit/Sou... File third_party/WebKit/Source/wtf/FlatSet.h (right): https://codereview.chromium.org/2396533004/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/wtf/FlatSet.h:65: DISALLOW_COPY_AND_ASSIGN(FlatSet); On 2016/10/07 09:49:11, Sami wrote: > STL containers are copyable and assignable -- is there a reason to be different > here? Done. https://codereview.chromium.org/2396533004/diff/120001/third_party/WebKit/Sou... File third_party/WebKit/Source/wtf/FlatTable.h (right): https://codereview.chromium.org/2396533004/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/wtf/FlatTable.h:141: // O(log n + n / 2) On 2016/10/07 09:49:11, Sami wrote: > Maybe document the return value? Done. https://codereview.chromium.org/2396533004/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/wtf/FlatTable.h:163: if (empty()) { On 2016/10/07 09:49:11, Sami wrote: > DCHECK that value is actually unique? > > Edit: I guess InsertUniqueImpl kinda does that already. Right, that should be enough? https://codereview.chromium.org/2396533004/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/wtf/FlatTable.h:253: size_t InsertUniqueImpl(value_type value) { On 2016/10/07 09:49:11, Sami wrote: > Maybe the great renaming will fix this but I find it a bit jarring that we're > 50% chrome/blink style here with names :) Done. https://codereview.chromium.org/2396533004/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/wtf/FlatTable.h:323: void ComputeModulusMask() { modulus_mask_ = ring_buffer_.size() - 1; } On 2016/10/07 09:49:11, Sami wrote: > DCHECK that this is 2^n-1? Done something similar. |