# In 10.1.0 BenchmarkPlot doesn't work?

Bug introduced in 10.1
This bug was resolved in 10.2.0, but another bug was introduced in 10.3.0 persisting through 10.3.1 and finally resolved in 10.4

In Mathematica 10.1.0 and 10.3.0 BenchmarkPlot from the GeneralUtilities package doesn't work and we shall focus on the situation of 10.1.0 here. Copying Taliesin Beynon's initial use of the function on this site:

Needs["GeneralUtilities"]

myPosIdx[x_] := <|Thread[x[[#[[All, 1]]]] -> #]|> &@GatherBy[Range@Length@x, x[[#]] &];


This evaluates as follows in 10.1.0

BenchmarkPlot[{PositionIndex, myPosIdx}, RandomInteger[100, #] &, 16,
"IncludeFits" -> True]


SymbolName::sym: Argument {37,31,57,40,5,78,99,97,78,49,82,60,98,80,68,62} at position 1 is expected to be a symbol. >>

SymbolName::sym: Argument {37,31,57,40,5,78,99,97,78,49,82,60,98,80,68,62} at position 1 is expected to be a symbol. >>

SymbolName::sym: Argument {37,31,57,40,5,78,99,97,78,49,82,60,98,80,68,62} at position 1 is expected to be a symbol. >>

General::stop: Further output of SymbolName::sym will be suppressed during this calculation. >>

What went wrong and how do I fix it?

• See the same in Ubuntu (consider this a confirmation!) – dr.blochwave May 12 '15 at 8:15
• This also no longer works on 10.1.0 for OSX. – Jacob Akkerboom May 12 '15 at 9:36
• I have reported this as "[CASE:3460529] PrintDefinitions from package GeneralUtilities bug" – Jacob Akkerboom Nov 4 '15 at 19:42
• @Sjoerd Has a solution for the new bug been identified? – Mr.Wizard Jan 10 '16 at 22:33
• @Mr.Wizard Not that I know of. I just tested it on 10.3.1 and it still gave these error messages. – Sjoerd C. de Vries Jan 10 '16 at 22:49

In addition to the error messages quoted in the question the line returns:

GeneralUtilitiesBenchmarkingPackagePrivateplot[
IndexBy[{{{16, 9.37132*10^-6}, . . .


IndexBy was removed from 10.1.0:

Note that IndexBy will be removed in a future version of Mathematica. It was something that was considered for 10.0.0 but didn't make the cut. – Stefan R Feb 26 at 17:37

We can therefore fix the problem by restoring the function IndexBy. I provided an improved definition for this function here:

We can either:

• Load this definition into the System context, e.g. SystemIndexBy = indexBy, or

• Redefine the BenchmarkPlot subfuction that uses IndexBy:

Get["GeneralUtilities"];

With[
{dv := DownValues[GeneralUtilitiesBenchmarkingPackagePrivateaddlabels]},
dv = dv /. SystemIndexBy -> indexBy;
]

• Hmm, so they removed IndexBy, but forgot to update BenchmarkPlot? And actually it looks very strange to remove a function in a minor update... – Ruslan May 12 '15 at 11:45
• @Ruslan IndexBy was an undocumented internal function so there was no obligation to keep it but it seems that there was a lack of communication or at least coordination within WRI regarding its existence. – Mr.Wizard May 12 '15 at 11:47
• Looks like BenchmarkPlot` has already been fixed in our latest development builds, but this is a great workaround until the next release! – Stefan R May 12 '15 at 17:43
• It now fails in 10.3 with a different error: First argument {{16.,{0.124288,<|9->{10000.},11->{20000.},6->{30000.},99->{40000.},57->{50000.},35->{60000.},88->{70000.},78->{80000.},61->{90000.},93->{100000.},76->{110000.,120000.},51->{130000.},23->{140000.},44->{150000.},74->{160000.}|>}},{24.,{<<1>>}},{36.,{0.241031,<|81->{10000.},19->{20000.},<<28>>,25->{360000.}|>}}} in NonlinearModelFit is not a list or a rectangular array. >> – Verbeia Oct 19 '15 at 3:24
• 10.4.1 contains a definition of IndexBy in GeneralUtilities. – Sjoerd C. de Vries May 4 '16 at 20:26