19
$\begingroup$

While I was running a code I wrote using version 10.1, I noticed that in version 10.2 the running time of the same code was more than twice as long. After some digging, I figured out the culprit is HistogramList. The following should reproduce the problem:

$Version
lis = Riffle[RandomReal[100, 10^6], -1];
First @ AbsoluteTiming @ HistogramList[lis, {0, 6, 0.02}]

"10.1.0 for Microsoft Windows (64-bit) (March 24, 2015)"

0.894027

$Version
lis = Riffle[RandomReal[100, 10^6], -1];
First @ AbsoluteTiming @ HistogramList[lis, {0, 6, 0.02}]

"10.2.0 for Microsoft Windows (64-bit) (July 7, 2015)"

2.43526

Can anyone confirm this?

$\endgroup$
11
$\begingroup$

It looks like this has not only been corrected in Mathematica 10.4, but has been made about 7 times faster than 10.1.

$Version 
lis = Riffle[RandomReal[100, 10^6], -1];
First @ AbsoluteTiming @ HistogramList[lis, {0, 6, 0.02}]

"10.4.0 for Microsoft Windows (64-bit) (February 26, 2016)"

0.12289

$\endgroup$
  • 2
    $\begingroup$ That's great! I've been complaining a lot to WRI about how badly Histogram performs and it seems they listened :-) $\endgroup$ – Szabolcs Mar 4 '16 at 11:39
  • 2
    $\begingroup$ Unfortunately, the bug introduced in 10.2 where it cannot handle outliers remains in v 10.4. Calculating the HistogramList of CountryData's ExchangeRate will consume all available memory ... so be prepared to kill the kernel while watching the memory consumption if you try to execute this at home ... HistogramList@ DeleteCases[ QuantityMagnitude@CountryData[#, "ExchangeRate"] & /@ CountryData[], _QuantityMagnitude] $\endgroup$ – Mark Kotanchek Mar 4 '16 at 13:51
  • 2
    $\begingroup$ @MarkKotanchek We are aware of that unfortunate issue. Regretfully, we do not yet have a fix, but are working on it. $\endgroup$ – Stefan R Mar 4 '16 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.