Performance characteristics of `KeyPath`

two years ago, using keypaths in performance-sensitive code was not a good idea. the linked issue is still open.

has anything changed since?

I can't speak for the GitHub issue, but the benchmarks seem to have improved since I last tested (with [this repository](GitHub - atfelix/keypaths-performance: Key paths are slow and tested on Max M1 Max)):

name                                    time              std         iterations
--------------------------------------------------------------------------------
-key path sorted :: name                12759325.500 ns ± 2.57 %        108
+key path sorted :: name                128666.000 ns ±   1.11 %      10823
-key path sorted :: age                 14797394.000 ns ± 3.27 %         93
+key path sorted :: age                 134375.000 ns ±   1.38 %      10371
-key path expressions sorted :: name    13089546.000 ns ± 3.94 %        106
+key path expressions sorted :: name    239833.000 ns ±   1.21 %       5817
-key path expressions sorted :: age     14440162.000 ns ± 2.42 %         95
+key path expressions sorted :: age     178208.000 ns ±   1.10 %       7815
-functions sorted :: name               102494.000 ns ±   9.12 %      13123
+functions sorted :: name               49041.000 ns ±    1.94 %      28500
-functions path sorted :: age           69360.000 ns ±    6.88 %      19774
+functions sorted :: age                41917.000 ns ±    4.10 %      32499
4 Likes