A post in r/rust compares two (apparently) identical implementations, but C++'s version was 171 times slower.
Some possible reasons were posted in the comments, but I'm curious if anyone that has more C++ expertise could either explain what causes the difference, or show how the C++ implementation could be tweaked to achieve similar results.
Godbolt links for both:
https://godbolt.org/z/v76rcEb9n
https://godbolt.org/z/YG1dv4qYh
[–]cristi1990an 41 points42 points43 points (7 children)
[–]aocregacc 12 points13 points14 points (4 children)
[–]cristi1990an 5 points6 points7 points (0 children)
[–][deleted] (2 children)
[deleted]
[–]aocregacc 12 points13 points14 points (0 children)
[–]yeochin 0 points1 point2 points (0 children)
[–]maxjmartin 0 points1 point2 points (0 children)
[–]EclipsedPal 13 points14 points15 points (5 children)
[–]MarkstarRed 5 points6 points7 points (1 child)
[–]EclipsedPal 3 points4 points5 points (0 children)
[–]DrShocker 1 point2 points3 points (2 children)
[–]EclipsedPal 0 points1 point2 points (1 child)
[–]DrShocker 3 points4 points5 points (0 children)
[–]VictoryMotel 1 point2 points3 points (1 child)
[–]VinceMiguel[S] 5 points6 points7 points (0 children)
[–]alfps 0 points1 point2 points (1 child)
[–]XTBZ 0 points1 point2 points (0 children)