Histogram is 150 times slower than BinCounts. Going from BinCounts to a good quality figure is not at all trivial. It might not be difficult but it certainly takes time. Dealing with this shortcoming of Histogram is often a significant time waster.
I understand that Histogramcan do lot more than BinCounts, but in the most common use case it just doesn’t have to. In this example above they do the exact same thing. Histogram should have special case optimizations for the most common use case.
I fully support this, I simply don’t use Histogram (or only when I have <1000 points). I always use BinCounts and feed it in to ListPlot.
What I did find, is that Histogram is already a lot faster if you explicitly tell the upper and lower bounds. With the specification of {0.1}, the ‘offset’ has a degree of freedom, by eliminating it, it is a lot faster…
That’s a good tip, thank you! It does indeed speed it up.
For personal use, I also use ListPlot. But when I show those plots to others, I get increasingly common complaints that they are not readable enough, etc. Thus I am compelled to produce a barchart-style thing.
In the meantime I found this suggestion to use WeightedData. One need to take special care to line up the bins carefully between the steps of the procedure, but this works:
A good quick solution, but seems like quite a `hack’ haha, should be more user friendly in my opinion, Now you still use Bincounts to do all the actual work, and (with just a few weighted datapoints) do the Histogram… neat but cumbersome I would say…