Ingest and analyze benchmark results posted at MathematicaStackExchange​
​by Anton Antonov​
November 2021

Introduction

In this notebook we show how to:
◼
  • Parse and ingest Mathematica / WL benchmark results posted at Mathematica StackExchange (MSE), like the ones posted here
  • ◼
  • Do rudimentary data analysis of the benchmark results
  • The “parsing” is based on the XML objects expressions extraction -- hence, it is, sort of, “universal.”
    Assumptions:
    ◼
  • There are multiple answers with benchmarks posted
  • ◼
  • The benchmark results have a certain clear "list of rules" form
  • The form is provided by:
    Needs["Benchmarking`"]
    BenchmarkReport[]
    Remark: This notebook was used for the answer of the MSE question [AA1].
    Remark: The benchmark results are taken from the answers of the MSE question [TT1].

    Ingestion

    Get all answers in a XML object:
    In[]:=
    xmlObject=Import["https://mathematica.stackexchange.com/questions/234881/benchmarking-with-mathematica-v-12-for-up-to-date-comparision-of-mathematica-acr/235384#235384","XMLObject"];
    Get code cells:
    In[]:=
    lsRes1=Cases[xmlObject,XMLElement["code",{},code_]code,∞];
    Drop Benchmark computation commands and convert to WL code:
    In[]:=
    lsRes2=Map[(ToExpression[Map[If[StringQ[#]&&SyntaxQ[#],#,Nothing]&,#]]&)@StringReplace[#,{"LaunchKernels[]""","BenchmarkReport[]""","Benchmark[]"""}]&,lsRes1];​​Length[lsRes2]
    Out[]=
    69
    Select lists of rules only:
    In[]:=
    lsRes3=Select[Flatten/@lsRes2,MatchQ[#,{_Rule..}]&&Length[#]>1&];​​Length[lsRes3]
    Out[]=
    31
    For each post flatten the metadata and benchmark results into associations:
    In[]:=
    lsRes4=Map[Association@Cases[Flatten[#/.HoldPattern["Results"r_](Rule@@@r)],_Rule]&,lsRes3];​​Length[lsRes4]
    Out[]=
    31
    Make sure all associations have the same keys:
    In[]:=
    lsRes5=Block[{lsAllKeys=Union[Flatten[Keys/@lsRes4]]},Map[Join[AssociationThread[lsAllKeys,"NA"],#]&,lsRes4]];​​Length[lsRes5]
    Out[]=
    31
    (Otherwise, the obtained dataset might be hard to use in some computations.)
    Make a comparison dataset:
    In[]:=
    Select[Union[Keys/@lsRes5]〚1〛,!StringQ[#]&]
    Out[]=
    {}
    In[]:=
    Dataset[lsRes5]
    Out[]=
    BenchmarkName
    BenchmarkResult
    Data Fitting
    Date
    Digits of Pi
    Discrete Fourier Transform
    Eigenvalues of a Matrix
    Elementary Functions
    FullVersionNumber
    Gamma Function
    WolframMark
    5.037
    0.224
    November 27, 2020
    0.204
    0.257
    0.322
    0.106
    12.1.1
    0.272
    WolframMark
    2.653
    0.395
    January 11, 2021
    0.281
    0.436
    0.37
    0.595
    12.2.0
    0.327
    WolframMark
    3.637
    0.247
    January 11, 2021
    0.235
    0.387
    0.319
    0.241
    12.2.0
    0.329
    WolframMark
    2.841
    0.322
    November 1, 2021
    0.206
    0.318
    0.409
    0.59
    12.3.1
    0.256
    WolframMark
    3.399
    0.252
    December 4, 2020
    0.212
    0.337
    0.323
    0.444
    12.1.1
    0.28
    WolframMark
    3.22
    0.22
    November 18, 2020
    0.312
    0.357
    0.303
    0.185
    12.1.1
    0.46
    WolframMark
    4.462
    NA
    December 4, 2020
    NA
    NA
    NA
    NA
    12.1.0
    NA
    WolframMark
    4.105
    NA
    December 6, 2020
    NA
    NA
    NA
    NA
    12.1.0
    NA
    WolframMark
    5.45
    0.168
    April 12, 2021
    0.18
    0.286
    0.272
    0.091
    12.2.0
    0.234
    WolframMark
    1.613
    0.478
    November 25, 2020
    0.34
    0.464
    0.528
    0.696
    12.0.0
    0.469
    WolframMark
    3.637
    0.263
    December 12, 2020
    0.222
    0.382
    0.285
    0.422
    12.1.1
    0.284
    WolframMark
    2.724
    0.29
    February 26, 2021
    0.284
    0.159
    0.508
    0.283
    12.0.0
    0.406
    WolframMark
    3.147
    0.191
    July 9, 2021
    0.171
    0.307
    0.453
    0.606
    12.3.1
    0.221
    WolframMark
    1.269
    0.493
    November 17, 2020
    0.348
    0.48
    0.471
    0.709
    12.0.0
    0.382
    WolframMark
    5.863
    0.146
    November 26, 2020
    0.172
    0.27
    0.224
    0.158
    12.1.1
    0.239
    WolframMark
    4.85
    0.191
    November 27, 2020
    0.187
    0.203
    0.234
    0.168
    12.1.1
    0.255
    WolframMark
    1.98
    0.482
    November 28, 2020
    0.358
    0.77
    0.458
    0.766
    12.1.1
    0.46
    WolframMark
    3.262
    0.261
    December 4, 2020
    0.234
    0.32
    0.308
    0.229
    12.1.1
    0.325
    WolframMark
    2.337
    0.409
    December 23, 2020
    0.308
    0.578
    0.487
    0.555
    12.1.0
    0.442
    WolframMark
    2.358
    0.446
    December 23, 2020
    0.312
    0.566
    0.479
    0.548
    12.2.0
    0.43
    rows 1–20 of 31
    columns 1–10 of 22
    In[]:=
    dsBenchmarks=Dataset[lsRes5];​​dsBenchmarks=dsBenchmarks[SortBy[#BenchmarkResult&]]
    Out[]=
    BenchmarkName
    BenchmarkResult
    Data Fitting
    Date
    Digits of Pi
    Discrete Fourier Transform
    Eigenvalues of a Matrix
    Elementary Functions
    FullVersionNumber
    Gamma Function
    WolframMark
    0.43
    2.181
    November 26, 2020
    1.008
    2.294
    1.751
    3.909
    12.1.1
    0.885
    WolframMark
    1.269
    0.493
    November 17, 2020
    0.348
    0.48
    0.471
    0.709
    12.0.0
    0.382
    WolframMark
    1.613
    0.478
    November 25, 2020
    0.34
    0.464
    0.528
    0.696
    12.0.0
    0.469
    WolframMark
    1.98
    0.482
    November 28, 2020
    0.358
    0.77
    0.458
    0.766
    12.1.1
    0.46
    WolframMark
    2.299
    0.501
    April 2, 2021
    0.298
    0.502
    0.404
    0.669
    12.2.0
    0.417
    WolframMark
    2.337
    0.409
    December 23, 2020
    0.308
    0.578
    0.487
    0.555
    12.1.0
    0.442
    WolframMark
    2.358
    0.446
    December 23, 2020
    0.312
    0.566
    0.479
    0.548
    12.2.0
    0.43
    WolframMark
    2.653
    0.395
    January 11, 2021
    0.281
    0.436
    0.37
    0.595
    12.2.0
    0.327
    WolframMark
    2.724
    0.29
    February 26, 2021
    0.284
    0.159
    0.508
    0.283
    12.0.0
    0.406
    WolframMark
    2.841
    0.322
    November 1, 2021
    0.206
    0.318
    0.409
    0.59
    12.3.1
    0.256
    WolframMark
    2.937
    0.28
    November 26, 2020
    0.282
    0.358
    0.326
    0.355
    12.1.1
    0.34
    WolframMark
    2.963
    0.22
    November 17, 2020
    0.234
    0.252
    0.264
    0.141
    12.1.1
    0.328
    WolframMark
    2.979
    0.319
    December 11, 2020
    0.252
    0.294
    0.346
    0.372
    12.1.1
    0.358
    WolframMark
    3.113
    0.324
    October 27, 2021
    0.237
    0.381
    0.273
    0.488
    12.3.0
    0.331
    WolframMark
    3.147
    0.191
    July 9, 2021
    0.171
    0.307
    0.453
    0.606
    12.3.1
    0.221
    WolframMark
    3.2
    0.219
    July 8, 2021
    0.17
    0.321
    0.416
    0.592
    12.3.1
    0.218
    WolframMark
    3.22
    0.22
    November 18, 2020
    0.312
    0.357
    0.303
    0.185
    12.1.1
    0.46
    WolframMark
    3.262
    0.261
    December 4, 2020
    0.234
    0.32
    0.308
    0.229
    12.1.1
    0.325
    WolframMark
    3.399
    0.252
    December 4, 2020
    0.212
    0.337
    0.323
    0.444
    12.1.1
    0.28
    NA
    3.591
    0.29
    NA
    0.249
    0.353
    0.294
    0.37
    12.2.0
    0.346
    rows 1–20 of 31
    columns 1–10 of 22

    Basic analysis

    Summarize the dataset:
    In[]:=
    ResourceFunction["RecordsSummary"][dsBenchmarks]
    Out[]=
    
    1 BenchmarkName
    WolframMark
    30
    NA
    1
    ,
    2 BenchmarkResult
    Min
    0.43
    1st Qu
    2.67075
    Median
    3.2
    Mean
    3.36568
    3rd Qu
    4.138
    Max
    6.055
    ,
    3 Data Fitting
    0.191
    2
    0.22
    2
    0.29
    2
    NA
    2
    0.146
    1
    0.148
    1
    (Other)
    21
    ,
    4 Date
    December 4, 2020
    3
    November 26, 2020
    3
    December 23, 2020
    2
    January 11, 2021
    2
    November 17, 2020
    2
    November 27, 2020
    2
    (Other)
    17
    ,
    5 Digits of Pi
    0.204
    2
    0.234
    2
    0.312
    2
    NA
    2
    0.17
    1
    0.171
    1
    (Other)
    21
    ,
    6 Discrete Fourier Transform
    0.159
    2
    NA
    2
    0.203
    1
    0.204
    1
    0.206
    1
    0.252
    1
    (Other)
    23
    ,
    7 Eigenvalues of a Matrix
    NA
    2
    0.193
    1
    0.224
    1
    0.234
    1
    0.244
    1
    0.256
    1
    (Other)
    24
    ,
    8 Elementary Functions
    NA
    2
    0.091
    1
    0.106
    1
    0.141
    1
    0.144
    1
    0.156
    1
    (Other)
    24
    ,
    9 FullVersionNumber
    12.1.1
    12
    12.2.0
    8
    12.0.0
    3
    12.1.0
    3
    12.3.1
    3
    12.3.0
    2
    ,
    10 Gamma Function
    0.46
    2
    NA
    2
    0.218
    1
    0.221
    1
    0.234
    1
    0.239
    1
    (Other)
    23
    ,
    11 Large Integer Multiplication
    0.345
    2
    NA
    2
    0.181
    1
    0.187
    1
    0.233
    1
    0.238
    1
    (Other)
    23
    ,
    12 MachineName
    macbook-pro
    3
    NA
    3
    4-node homogeneous cluster
    2
    desktop-n3opac6
    2
    laederlappen
    2
    amos
    1
    (Other)
    18
    ,
    13 Matrix Arithmetic
    NA
    2
    0.035
    1
    0.056
    1
    0.06
    1
    0.068
    1
    0.099
    1
    (Other)
    24
    ,
    14 Matrix Multiplication
    0.253
    2
    NA
    2
    0.051
    1
    0.067
    1
    0.068
    1
    0.074
    1
    (Other)
    23
    ,
    15 Matrix Transpose
    NA
    2
    0.149
    1
    0.161
    1
    0.174
    1
    0.181
    1
    0.184
    1
    (Other)
    24
    ,
    16 Numerical Integration
    0.371
    2
    NA
    2
    0.266
    1
    0.273
    1
    0.315
    1
    0.322
    1
    (Other)
    23
    ,
    17 Polynomial Expansion
    0.042
    2
    0.043
    2
    0.044
    2
    0.048
    2
    0.057
    2
    NA
    2
    (Other)
    19
    ,
    18 Random Number Sort
    0.059
    3
    0.112
    2
    NA
    2
    0.049
    1
    0.098
    1
    0.109
    1
    (Other)
    21
    ,
    19 Singular Value Decomposition
    NA
    2
    0.095
    1
    0.123
    1
    0.14
    1
    0.141
    1
    0.155
    1
    (Other)
    24
    ,
    20 Solving a Linear System
    0.289
    2
    0.318
    2
    0.406
    2
    NA
    2
    0.093
    1
    0.116
    1
    (Other)
    21
    ,
    21 System
    Microsoft Windows (64-bit)
    11
    Mac OS X x86 (64-bit)
    9
    Linux x86 (64-bit)
    6
    Mac OS X ARM (64-bit)
    2
    Windows-x86-64
    2
    NA
    1
    ,
    22 TotalTime
    Min
    2.286
    1st Qu
    3.806
    Median
    4.446
    3rd Qu
    5.9105
    Mean
    7.73039
    Max
    40.462
    
    (Bar) plot results:

    Breakdown statistics

    Using a `Map`-version of the code above we can do statistical plots per system:
    Partition benchmark results per system:
    Separate the overall benchmark results from the benchmark component results:
    Show the overall benchmark results:
    Show distribution statistical plots per system:
    (Note, that we have to keep an eye on the number of available benchmarks per system. Some of those numbers are too small here...)

    References

    [TT1] Tugrul Temel, "Benchmarking with Mathematica v.12 for up to date comparison across different machines", (2020), MathematicaStackExchange.
    [AA1] Anton Antonov, "How can I ingest and analyze benchmark results posted at MSE?”, (2020), MathematicaStackExchange.