Skip to content

Commit

Permalink
Don't use iterators for FlatMap equality checks (#26)
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
  • Loading branch information
jviotti authored Jan 22, 2025
1 parent 214d23b commit 2ce51f8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/flat_map/include/sourcemeta/noa/flat_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,10 @@ template <typename Key, typename Value, typename Hash> class FlatMap {
}

for (const auto &entry : this->data) {
const auto iterator{other.find(entry.first, entry.hash)};
if (iterator == other.cend()) {
const auto *result{other.try_at(entry.first, entry.hash)};
if (!result) {
return false;
} else if (iterator->second != entry.second) {
} else if (*result != entry.second) {
return false;
}
}
Expand Down

8 comments on commit 2ce51f8

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark (macos/llvm)

Benchmark suite Current: 2ce51f8 Previous: 214d23b Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 1.758811181378275 ns/iter 1.6401514303339735 ns/iter 1.07
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 1.7554718870333406 ns/iter 1.5944826791695377 ns/iter 1.10
Regex_Period_Asterisk 1.7555516257411543 ns/iter 1.5968626160683688 ns/iter 1.10
Regex_Group_Period_Asterisk_Group 1.7328980747663763 ns/iter 1.62399569454731 ns/iter 1.07
Regex_Period_Plus 2.1554397148615787 ns/iter 1.9352386635555838 ns/iter 1.11
Regex_Period 2.0450699832983465 ns/iter 1.9471920043530595 ns/iter 1.05
Regex_Caret_Period_Plus_Dollar 2.1006677401441776 ns/iter 1.9271781290128638 ns/iter 1.09
Regex_Caret_Group_Period_Plus_Group_Dollar 2.033284184858272 ns/iter 1.9170267888698804 ns/iter 1.06
Regex_Caret_Period_Asterisk_Dollar 1.7000200022358607 ns/iter 1.5969896400338144 ns/iter 1.06
Regex_Caret_Group_Period_Asterisk_Group_Dollar 1.7962111396354867 ns/iter 1.600677523665264 ns/iter 1.12
Regex_Caret_X_Hyphen 7.070217039432861 ns/iter 6.749282019105777 ns/iter 1.05
Regex_Period_Md_Dollar 81.73677331212576 ns/iter 70.73669768358648 ns/iter 1.16
Regex_Caret_Slash_Period_Asterisk 5.544172849215101 ns/iter 5.084395979246659 ns/iter 1.09
Regex_Caret_Period_Range_Dollar 2.4926121918478805 ns/iter 2.228777172474936 ns/iter 1.12
Regex_Nested_Backtrack 848.5993950042179 ns/iter 751.2890471935256 ns/iter 1.13

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark (linux/llvm)

Benchmark suite Current: 2ce51f8 Previous: 214d23b Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 2.2402313558360953 ns/iter 2.2050867231326547 ns/iter 1.02
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 2.2457284637480823 ns/iter 2.2100882315668424 ns/iter 1.02
Regex_Period_Asterisk 2.231151469827712 ns/iter 2.1978781538054655 ns/iter 1.02
Regex_Group_Period_Asterisk_Group 2.231166014341916 ns/iter 2.194200727383446 ns/iter 1.02
Regex_Period_Plus 2.499225534538898 ns/iter 2.5552775977381 ns/iter 0.98
Regex_Period 2.4883829145298737 ns/iter 2.492076400102254 ns/iter 1.00
Regex_Caret_Period_Plus_Dollar 2.4859927782479785 ns/iter 2.2425677651340394 ns/iter 1.11
Regex_Caret_Group_Period_Plus_Group_Dollar 2.48973811367169 ns/iter 2.357148097311435 ns/iter 1.06
Regex_Caret_Period_Asterisk_Dollar 3.2815712726573745 ns/iter 2.486882812300636 ns/iter 1.32
Regex_Caret_Group_Period_Asterisk_Group_Dollar 2.2189332617163373 ns/iter 2.4877530515428172 ns/iter 0.89
Regex_Caret_X_Hyphen 12.636708373386544 ns/iter 13.053329939595303 ns/iter 0.97
Regex_Period_Md_Dollar 73.27911566584737 ns/iter 73.97677875287161 ns/iter 0.99
Regex_Caret_Slash_Period_Asterisk 6.224290903499836 ns/iter 7.160430719688381 ns/iter 0.87
Regex_Caret_Period_Range_Dollar 4.043955855890035 ns/iter 4.039346444819488 ns/iter 1.00
Regex_Nested_Backtrack 456.8279317815521 ns/iter 458.01741358677566 ns/iter 1.00

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark (linux/gcc)

Benchmark suite Current: 2ce51f8 Previous: 214d23b Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 2.8139461901879828 ns/iter 3.7418133562061575 ns/iter 0.75
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 2.798557939344714 ns/iter 3.7278165694701837 ns/iter 0.75
Regex_Period_Asterisk 2.7988072099820847 ns/iter 3.7297565229277674 ns/iter 0.75
Regex_Group_Period_Asterisk_Group 2.7997438853602845 ns/iter 3.7288010954764115 ns/iter 0.75
Regex_Period_Plus 2.8000143146004377 ns/iter 3.7357140064808174 ns/iter 0.75
Regex_Period 2.800024125389924 ns/iter 3.7282925348027427 ns/iter 0.75
Regex_Caret_Period_Plus_Dollar 3.1106701504524903 ns/iter 3.7309961505397142 ns/iter 0.83
Regex_Caret_Group_Period_Plus_Group_Dollar 3.1109992067622803 ns/iter 3.7296894842484156 ns/iter 0.83
Regex_Caret_Period_Asterisk_Dollar 4.042629948601212 ns/iter 3.7324915127605673 ns/iter 1.08
Regex_Caret_Group_Period_Asterisk_Group_Dollar 3.728267478032703 ns/iter 3.7279085104007583 ns/iter 1.00
Regex_Caret_X_Hyphen 12.431246292976804 ns/iter 12.431306255993519 ns/iter 1.00
Regex_Period_Md_Dollar 89.44119480044044 ns/iter 89.63559153647003 ns/iter 1.00
Regex_Caret_Slash_Period_Asterisk 7.466836649321551 ns/iter 6.522908908999184 ns/iter 1.14
Regex_Caret_Period_Range_Dollar 4.350941167399434 ns/iter 4.357682754572321 ns/iter 1.00
Regex_Nested_Backtrack 831.4294948549976 ns/iter 836.166719026071 ns/iter 0.99

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark (macos/llvm)

Benchmark suite Current: 2ce51f8 Previous: 214d23b Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 1.5700487812441373 ns/iter 1.6401514303339735 ns/iter 0.96
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 1.5831157713256598 ns/iter 1.5944826791695377 ns/iter 0.99
Regex_Period_Asterisk 1.6137278910273962 ns/iter 1.5968626160683688 ns/iter 1.01
Regex_Group_Period_Asterisk_Group 1.567847283893261 ns/iter 1.62399569454731 ns/iter 0.97
Regex_Period_Plus 1.8859542892340735 ns/iter 1.9352386635555838 ns/iter 0.97
Regex_Period 1.8825247508224847 ns/iter 1.9471920043530595 ns/iter 0.97
Regex_Caret_Period_Plus_Dollar 1.9015837522468932 ns/iter 1.9271781290128638 ns/iter 0.99
Regex_Caret_Group_Period_Plus_Group_Dollar 1.8902626676425072 ns/iter 1.9170267888698804 ns/iter 0.99
Regex_Caret_Period_Asterisk_Dollar 1.5701413612268826 ns/iter 1.5969896400338144 ns/iter 0.98
Regex_Caret_Group_Period_Asterisk_Group_Dollar 1.5733172588936801 ns/iter 1.600677523665264 ns/iter 0.98
Regex_Caret_X_Hyphen 6.585900479371276 ns/iter 6.749282019105777 ns/iter 0.98
Regex_Period_Md_Dollar 67.57618586760034 ns/iter 70.73669768358648 ns/iter 0.96
Regex_Caret_Slash_Period_Asterisk 5.016110988008529 ns/iter 5.084395979246659 ns/iter 0.99
Regex_Caret_Period_Range_Dollar 2.193084784589622 ns/iter 2.228777172474936 ns/iter 0.98
Regex_Nested_Backtrack 728.014448737903 ns/iter 751.2890471935256 ns/iter 0.97

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark (linux/llvm)

Benchmark suite Current: 2ce51f8 Previous: 214d23b Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 2.199307607881867 ns/iter 2.2050867231326547 ns/iter 1.00
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 2.1968042504597416 ns/iter 2.2100882315668424 ns/iter 0.99
Regex_Period_Asterisk 2.197131998395807 ns/iter 2.1978781538054655 ns/iter 1.00
Regex_Group_Period_Asterisk_Group 2.222642229197202 ns/iter 2.194200727383446 ns/iter 1.01
Regex_Period_Plus 2.486941810793137 ns/iter 2.5552775977381 ns/iter 0.97
Regex_Period 2.487411261677186 ns/iter 2.492076400102254 ns/iter 1.00
Regex_Caret_Period_Plus_Dollar 2.4932047878982577 ns/iter 2.2425677651340394 ns/iter 1.11
Regex_Caret_Group_Period_Plus_Group_Dollar 2.4881038443075294 ns/iter 2.357148097311435 ns/iter 1.06
Regex_Caret_Period_Asterisk_Dollar 3.419975495537027 ns/iter 2.486882812300636 ns/iter 1.38
Regex_Caret_Group_Period_Asterisk_Group_Dollar 3.4183240475531855 ns/iter 2.4877530515428172 ns/iter 1.37
Regex_Caret_X_Hyphen 13.058553294204932 ns/iter 13.053329939595303 ns/iter 1.00
Regex_Period_Md_Dollar 73.44419609288495 ns/iter 73.97677875287161 ns/iter 0.99
Regex_Caret_Slash_Period_Asterisk 7.158550399903598 ns/iter 7.160430719688381 ns/iter 1.00
Regex_Caret_Period_Range_Dollar 4.041534228320043 ns/iter 4.039346444819488 ns/iter 1.00
Regex_Nested_Backtrack 474.83861242869085 ns/iter 458.01741358677566 ns/iter 1.04

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark (windows/msvc)

Benchmark suite Current: 2ce51f8 Previous: 214d23b Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 7.166553571428734 ns/iter 6.9072165178571 ns/iter 1.04
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 6.958873883928161 ns/iter 6.883229910714661 ns/iter 1.01
Regex_Period_Asterisk 6.92426674107262 ns/iter 7.090626116072078 ns/iter 0.98
Regex_Group_Period_Asterisk_Group 7.535869419643047 ns/iter 7.217571428571442 ns/iter 1.04
Regex_Period_Plus 7.334024553572301 ns/iter 7.219037946428435 ns/iter 1.02
Regex_Period 7.4755412946420865 ns/iter 7.220366485623528 ns/iter 1.04
Regex_Caret_Period_Plus_Dollar 7.2601231818739675 ns/iter 7.2370301339283065 ns/iter 1.00
Regex_Caret_Group_Period_Plus_Group_Dollar 7.341179687500191 ns/iter 7.178620950095945 ns/iter 1.02
Regex_Caret_Period_Asterisk_Dollar 6.84923750000012 ns/iter 6.850829433701918 ns/iter 1.00
Regex_Caret_Group_Period_Asterisk_Group_Dollar 7.175982142857101 ns/iter 6.961850000000221 ns/iter 1.03
Regex_Caret_X_Hyphen 11.905601785713316 ns/iter 11.88890714285711 ns/iter 1.00
Regex_Period_Md_Dollar 138.799962553572 ns/iter 137.56646037651123 ns/iter 1.01
Regex_Caret_Slash_Period_Asterisk 10.642039062501496 ns/iter 10.521857812499036 ns/iter 1.01
Regex_Caret_Period_Range_Dollar 7.533431919643111 ns/iter 7.558535714286155 ns/iter 1.00
Regex_Nested_Backtrack 596.2288392857268 ns/iter 598.9221428571057 ns/iter 1.00

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark (linux/gcc)

Benchmark suite Current: 2ce51f8 Previous: 214d23b Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 3.770786870485235 ns/iter 3.7418133562061575 ns/iter 1.01
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 3.735314059678621 ns/iter 3.7278165694701837 ns/iter 1.00
Regex_Period_Asterisk 3.727509428353618 ns/iter 3.7297565229277674 ns/iter 1.00
Regex_Group_Period_Asterisk_Group 3.7295070585594408 ns/iter 3.7288010954764115 ns/iter 1.00
Regex_Period_Plus 3.728761856055969 ns/iter 3.7357140064808174 ns/iter 1.00
Regex_Period 3.728782825792606 ns/iter 3.7282925348027427 ns/iter 1.00
Regex_Caret_Period_Plus_Dollar 3.7316578515933205 ns/iter 3.7309961505397142 ns/iter 1.00
Regex_Caret_Group_Period_Plus_Group_Dollar 3.7284569965221452 ns/iter 3.7296894842484156 ns/iter 1.00
Regex_Caret_Period_Asterisk_Dollar 3.737368029768578 ns/iter 3.7324915127605673 ns/iter 1.00
Regex_Caret_Group_Period_Asterisk_Group_Dollar 3.72916489460547 ns/iter 3.7279085104007583 ns/iter 1.00
Regex_Caret_X_Hyphen 12.43627743188768 ns/iter 12.431306255993519 ns/iter 1.00
Regex_Period_Md_Dollar 89.74251022654886 ns/iter 89.63559153647003 ns/iter 1.00
Regex_Caret_Slash_Period_Asterisk 7.467573820468832 ns/iter 6.522908908999184 ns/iter 1.14
Regex_Caret_Period_Range_Dollar 4.352194698386374 ns/iter 4.357682754572321 ns/iter 1.00
Regex_Nested_Backtrack 829.1964580087097 ns/iter 836.166719026071 ns/iter 0.99

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark (windows/msvc)

Benchmark suite Current: 2ce51f8 Previous: 214d23b Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 7.0940446428569 ns/iter 6.9072165178571 ns/iter 1.03
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 7.175428571428403 ns/iter 6.883229910714661 ns/iter 1.04
Regex_Period_Asterisk 6.967736607142529 ns/iter 7.090626116072078 ns/iter 0.98
Regex_Group_Period_Asterisk_Group 6.954904017858001 ns/iter 7.217571428571442 ns/iter 0.96
Regex_Period_Plus 7.5241127232139595 ns/iter 7.219037946428435 ns/iter 1.04
Regex_Period 7.3141104910717 ns/iter 7.220366485623528 ns/iter 1.01
Regex_Caret_Period_Plus_Dollar 7.178859342950812 ns/iter 7.2370301339283065 ns/iter 0.99
Regex_Caret_Group_Period_Plus_Group_Dollar 7.439654017857527 ns/iter 7.178620950095945 ns/iter 1.04
Regex_Caret_Period_Asterisk_Dollar 7.190148437499846 ns/iter 6.850829433701918 ns/iter 1.05
Regex_Caret_Group_Period_Asterisk_Group_Dollar 6.911563616071196 ns/iter 6.961850000000221 ns/iter 0.99
Regex_Caret_X_Hyphen 14.30859151785567 ns/iter 11.88890714285711 ns/iter 1.20
Regex_Period_Md_Dollar 139.81977500804607 ns/iter 137.56646037651123 ns/iter 1.02
Regex_Caret_Slash_Period_Asterisk 10.40948392857136 ns/iter 10.521857812499036 ns/iter 0.99
Regex_Caret_Period_Range_Dollar 7.639246651785265 ns/iter 7.558535714286155 ns/iter 1.01
Regex_Nested_Backtrack 601.5742857142317 ns/iter 598.9221428571057 ns/iter 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.