Skip to content

[Type] Matrix: clean, templated functions and add double benchmarks#43

Merged
alxbilger merged 2 commits intoalxbilger:mainfrom
fredroy:refresh_mat_benches
Feb 2, 2026
Merged

[Type] Matrix: clean, templated functions and add double benchmarks#43
alxbilger merged 2 commits intoalxbilger:mainfrom
fredroy:refresh_mat_benches

Conversation

@fredroy
Copy link
Collaborator

@fredroy fredroy commented Feb 2, 2026

For reference:

---------------------------------------------------------------------------------------------
Benchmark                                                   Time             CPU   Iterations
---------------------------------------------------------------------------------------------
BM_Matrix_typemat3x3_construct<float>/512               0.579 us        0.579 us      1189106
BM_Matrix_typemat3x3_construct<float>/1024               1.16 us         1.16 us       597386
BM_Matrix_typemat3x3_construct<float>/2048               2.32 us         2.32 us       301394
BM_Matrix_typemat3x3_construct<double>/512              0.496 us        0.496 us      1408265
BM_Matrix_typemat3x3_construct<double>/1024             0.988 us        0.988 us       707940
BM_Matrix_typemat3x3_construct<double>/2048              1.97 us         1.97 us       355088
BM_Matrix_typemat3x3_construct_noinit<float>/512        0.579 us        0.579 us      1222639
BM_Matrix_typemat3x3_construct_noinit<float>/1024        1.16 us         1.16 us       602978
BM_Matrix_typemat3x3_construct_noinit<float>/2048        2.32 us         2.32 us       301552
BM_Matrix_typemat3x3_construct_noinit<double>/512       0.487 us        0.487 us      1432345
BM_Matrix_typemat3x3_construct_noinit<double>/1024      0.971 us        0.970 us       722325
BM_Matrix_typemat3x3_construct_noinit<double>/2048       1.92 us         1.92 us       361677
BM_Matrix_typemat3x3_transpose<float>/512               0.588 us        0.588 us      1184440
BM_Matrix_typemat3x3_transpose<float>/1024               1.17 us         1.17 us       596101
BM_Matrix_typemat3x3_transpose<float>/2048               2.65 us         2.64 us       265830
BM_Matrix_typemat3x3_transpose<double>/512              0.873 us        0.873 us       797691
BM_Matrix_typemat3x3_transpose<double>/1024              1.97 us         1.97 us       353188
BM_Matrix_typemat3x3_transpose<double>/2048              3.97 us         3.97 us       176653
BM_Matrix_typemat3x3_invert<float>/512                   2.62 us         2.62 us       268439
BM_Matrix_typemat3x3_invert<float>/1024                  5.21 us         5.21 us       133543
BM_Matrix_typemat3x3_invert<float>/2048                  10.4 us         10.4 us        66940
BM_Matrix_typemat3x3_invert<double>/512                  3.47 us         3.47 us       200442
BM_Matrix_typemat3x3_invert<double>/1024                 6.92 us         6.92 us       100351
BM_Matrix_typemat3x3_invert<double>/2048                 13.9 us         13.9 us        50062
BM_Matrix_typemat3x3_determinant<float>/512             0.649 us        0.649 us      1073947
BM_Matrix_typemat3x3_determinant<float>/1024             1.30 us         1.30 us       539439
BM_Matrix_typemat3x3_determinant<float>/2048             2.60 us         2.60 us       268295
BM_Matrix_typemat3x3_determinant<double>/512            0.646 us        0.646 us      1089623
BM_Matrix_typemat3x3_determinant<double>/1024            1.34 us         1.34 us       516699
BM_Matrix_typemat3x3_determinant<double>/2048            2.67 us         2.67 us       260411
BM_Matrix_typemat_matmult<float, 3>/512                  1.54 us         1.54 us       452324
BM_Matrix_typemat_matmult<float, 3>/1024                 3.08 us         3.08 us       226642
BM_Matrix_typemat_matmult<float, 3>/2048                 6.16 us         6.16 us       112635
BM_Matrix_typemat_matmult<double, 3>/512                 1.73 us         1.73 us       401970
BM_Matrix_typemat_matmult<double, 3>/1024                3.47 us         3.47 us       201947
BM_Matrix_typemat_matmult<double, 3>/2048                6.92 us         6.92 us        99931
BM_Matrix_typemat_matmult<float, 6>/512                  23.9 us         23.9 us        29448
BM_Matrix_typemat_matmult<float, 6>/1024                 47.9 us         47.9 us        14537
BM_Matrix_typemat_matmult<float, 6>/2048                 95.3 us         95.3 us         7270
BM_Matrix_typemat_matmult<double, 6>/512                 24.6 us         24.6 us        28482
BM_Matrix_typemat_matmult<double, 6>/1024                49.3 us         49.3 us        14211
BM_Matrix_typemat_matmult<double, 6>/2048                98.6 us         98.5 us         7065
BM_Matrix_typemat_matmult<float, 24>/512                 2088 us         2088 us          333
BM_Matrix_typemat_matmult<float, 24>/1024                4281 us         4281 us          166
BM_Matrix_typemat_matmult<float, 24>/2048                8496 us         8495 us           79
BM_Matrix_typemat_matmult<double, 24>/512                1880 us         1879 us          371
BM_Matrix_typemat_matmult<double, 24>/1024               3784 us         3784 us          185
BM_Matrix_typemat_matmult<double, 24>/2048               7746 us         7745 us           89
BM_Matrix_typemat_vecmult<float, 3>/512                 0.722 us        0.722 us       957334
BM_Matrix_typemat_vecmult<float, 3>/1024                 1.52 us         1.52 us       459710
BM_Matrix_typemat_vecmult<float, 3>/2048                 3.02 us         3.02 us       230703
BM_Matrix_typemat_vecmult<double, 3>/512                0.809 us        0.809 us       854849
BM_Matrix_typemat_vecmult<double, 3>/1024                1.67 us         1.67 us       416414
BM_Matrix_typemat_vecmult<double, 3>/2048                3.34 us         3.34 us       209030
BM_Matrix_typemat_vecmult<float, 6>/512                  2.78 us         2.78 us       270710
BM_Matrix_typemat_vecmult<float, 6>/1024                 5.52 us         5.52 us       103825
BM_Matrix_typemat_vecmult<float, 6>/2048                 10.4 us         10.4 us        67237
BM_Matrix_typemat_vecmult<double, 6>/512                 2.90 us         2.90 us       241592
BM_Matrix_typemat_vecmult<double, 6>/1024                5.82 us         5.82 us       119400
BM_Matrix_typemat_vecmult<double, 6>/2048                11.6 us         11.6 us        59630
BM_Matrix_typemat_vecmult<float, 24>/512                 84.2 us         84.2 us         8626
BM_Matrix_typemat_vecmult<float, 24>/1024                 168 us          168 us         4030
BM_Matrix_typemat_vecmult<float, 24>/2048                 337 us          337 us         2099
BM_Matrix_typemat_vecmult<double, 24>/512                85.3 us         85.3 us         8111
BM_Matrix_typemat_vecmult<double, 24>/1024                170 us          170 us         4139
BM_Matrix_typemat_vecmult<double, 24>/2048                342 us          342 us         2041
BM_Matrix_typemat3x3_assign<float>/512                  0.575 us        0.575 us      1206089
BM_Matrix_typemat3x3_assign<float>/1024                  1.16 us         1.16 us       603018
BM_Matrix_typemat3x3_assign<float>/2048                  2.31 us         2.31 us       302253
BM_Matrix_typemat3x3_assign<double>/512                 0.488 us        0.488 us      1434481
BM_Matrix_typemat3x3_assign<double>/1024                0.963 us        0.963 us       721575
BM_Matrix_typemat3x3_assign<double>/2048                 1.89 us         1.89 us       368600
BM_Matrix_typemat3x3_multTranspose<float>/512            2.50 us         2.50 us       280416
BM_Matrix_typemat3x3_multTranspose<float>/1024           5.12 us         5.12 us       135750
BM_Matrix_typemat3x3_multTranspose<float>/2048           10.2 us         10.2 us        68247
BM_Matrix_typemat3x3_multTranspose<double>/512           2.65 us         2.65 us       266250
BM_Matrix_typemat3x3_multTranspose<double>/1024          5.26 us         5.26 us       131820
BM_Matrix_typemat3x3_multTranspose<double>/2048          10.4 us         10.4 us        66779
BM_Matrix_eigenmat3x3_construct<float>/512              0.575 us        0.575 us      1210528
BM_Matrix_eigenmat3x3_construct<float>/1024              1.15 us         1.15 us       604338
BM_Matrix_eigenmat3x3_construct<float>/2048              2.31 us         2.31 us       304021
BM_Matrix_eigenmat3x3_construct<double>/512             0.579 us        0.578 us      1205414
BM_Matrix_eigenmat3x3_construct<double>/1024             1.15 us         1.15 us       603990
BM_Matrix_eigenmat3x3_construct<double>/2048             2.30 us         2.30 us       302897
BM_Matrix_eigenmat3x3_transpose<float>/512              0.577 us        0.577 us      1205916
BM_Matrix_eigenmat3x3_transpose<float>/1024              1.16 us         1.16 us       603725
BM_Matrix_eigenmat3x3_transpose<float>/2048              2.31 us         2.31 us       300089
BM_Matrix_eigenmat3x3_transpose<double>/512             0.418 us        0.418 us      1670150
BM_Matrix_eigenmat3x3_transpose<double>/1024             1.02 us         1.02 us       683479
BM_Matrix_eigenmat3x3_transpose<double>/2048             2.05 us         2.05 us       343103
BM_Matrix_eigenmat3x3_invert<float>/512                  2.22 us         2.22 us       316699
BM_Matrix_eigenmat3x3_invert<float>/1024                 4.42 us         4.42 us       157892
BM_Matrix_eigenmat3x3_invert<float>/2048                 8.87 us         8.87 us        78670
BM_Matrix_eigenmat3x3_invert<double>/512                 1.61 us         1.61 us       435067
BM_Matrix_eigenmat3x3_invert<double>/1024                3.23 us         3.23 us       215697
BM_Matrix_eigenmat3x3_invert<double>/2048                6.45 us         6.45 us       107563
BM_Matrix_eigenmat3x3_determinant<float>/512            0.523 us        0.523 us      1330224
BM_Matrix_eigenmat3x3_determinant<float>/1024            1.04 us         1.04 us       668177
BM_Matrix_eigenmat3x3_determinant<float>/2048            2.13 us         2.13 us       326373
BM_Matrix_eigenmat3x3_determinant<double>/512           0.524 us        0.524 us      1331359
BM_Matrix_eigenmat3x3_determinant<double>/1024           1.09 us         1.09 us       636367
BM_Matrix_eigenmat3x3_determinant<double>/2048           2.20 us         2.20 us       317365
BM_Matrix_eigenmat_matmult<float, 3>/512                 2.06 us         2.06 us       337531
BM_Matrix_eigenmat_matmult<float, 3>/1024                4.20 us         4.19 us       166559
BM_Matrix_eigenmat_matmult<float, 3>/2048                8.40 us         8.40 us        83194
BM_Matrix_eigenmat_matmult<double, 3>/512                1.75 us         1.75 us       400442
BM_Matrix_eigenmat_matmult<double, 3>/1024               3.48 us         3.48 us       199876
BM_Matrix_eigenmat_matmult<double, 3>/2048               6.99 us         6.99 us        99800
BM_Matrix_eigenmat_matmult<float, 6>/512                 10.9 us         10.9 us        59584
BM_Matrix_eigenmat_matmult<float, 6>/1024                21.2 us         21.2 us        33112
BM_Matrix_eigenmat_matmult<float, 6>/2048                43.2 us         43.2 us        16582
BM_Matrix_eigenmat_matmult<double, 6>/512                11.9 us         11.9 us        58446
BM_Matrix_eigenmat_matmult<double, 6>/1024               23.9 us         23.9 us        29227
BM_Matrix_eigenmat_matmult<double, 6>/2048               48.1 us         48.0 us        14585
BM_Matrix_eigenmat_matmult<float, 24>/512                 361 us          361 us         1937
BM_Matrix_eigenmat_matmult<float, 24>/1024                722 us          722 us          969
BM_Matrix_eigenmat_matmult<float, 24>/2048               1476 us         1476 us          474
BM_Matrix_eigenmat_matmult<double, 24>/512                712 us          712 us          975
BM_Matrix_eigenmat_matmult<double, 24>/1024              1437 us         1437 us          480
BM_Matrix_eigenmat_matmult<double, 24>/2048              3081 us         3081 us          227
BM_Matrix_eigenmat_vecmult<float, 3>/512                0.802 us        0.801 us       864473
BM_Matrix_eigenmat_vecmult<float, 3>/1024                1.66 us         1.66 us       422782
BM_Matrix_eigenmat_vecmult<float, 3>/2048                3.28 us         3.28 us       213442
BM_Matrix_eigenmat_vecmult<double, 3>/512               0.732 us        0.732 us       951869
BM_Matrix_eigenmat_vecmult<double, 3>/1024               1.49 us         1.49 us       467593
BM_Matrix_eigenmat_vecmult<double, 3>/2048               2.99 us         2.99 us       234730
BM_Matrix_eigenmat_vecmult<float, 6>/512                 1.79 us         1.79 us       388093
BM_Matrix_eigenmat_vecmult<float, 6>/1024                3.60 us         3.60 us       194217
BM_Matrix_eigenmat_vecmult<float, 6>/2048                7.04 us         7.04 us        96671
BM_Matrix_eigenmat_vecmult<double, 6>/512                1.95 us         1.95 us       358813
BM_Matrix_eigenmat_vecmult<double, 6>/1024               3.91 us         3.91 us       180632
BM_Matrix_eigenmat_vecmult<double, 6>/2048               7.79 us         7.79 us        88419
BM_Matrix_eigenmat_vecmult<float, 24>/512                18.8 us         18.8 us        37207
BM_Matrix_eigenmat_vecmult<float, 24>/1024               40.1 us         40.1 us        17504
BM_Matrix_eigenmat_vecmult<float, 24>/2048               80.6 us         80.6 us         8431
BM_Matrix_eigenmat_vecmult<double, 24>/512               32.2 us         32.2 us        21553
BM_Matrix_eigenmat_vecmult<double, 24>/1024              69.1 us         69.1 us        10038
BM_Matrix_eigenmat_vecmult<double, 24>/2048               143 us          143 us         4845
BM_Matrix_eigenmat3x3_assign<float>/512                 0.580 us        0.579 us      1200527
BM_Matrix_eigenmat3x3_assign<float>/1024                 1.15 us         1.15 us       603957
BM_Matrix_eigenmat3x3_assign<float>/2048                 2.31 us         2.31 us       302645
BM_Matrix_eigenmat3x3_assign<double>/512                0.492 us        0.492 us      1423180
BM_Matrix_eigenmat3x3_assign<double>/1024               0.981 us        0.981 us       714472
BM_Matrix_eigenmat3x3_assign<double>/2048                1.95 us         1.95 us       357253
BM_Matrix_eigenmat3x3_multTranspose<float>/512           2.04 us         2.04 us       343530
BM_Matrix_eigenmat3x3_multTranspose<float>/1024          4.07 us         4.07 us       171680
BM_Matrix_eigenmat3x3_multTranspose<float>/2048          8.16 us         8.16 us        84007
BM_Matrix_eigenmat3x3_multTranspose<double>/512          1.96 us         1.96 us       356372
BM_Matrix_eigenmat3x3_multTranspose<double>/1024         3.99 us         3.99 us       179840
BM_Matrix_eigenmat3x3_multTranspose<double>/2048         9.08 us         9.08 us        74699

(On a i7 13700k, Ubuntu 22.04, gcc12, LTO, -O3)

@fredroy fredroy added the enhancement New feature or request label Feb 2, 2026
@alxbilger alxbilger merged commit 3b71057 into alxbilger:main Feb 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants