# Tag Info

## Hot answers tagged performance-tuning

16

We can take advantage of the fact that IntegerDigits is very fast when the base is large. But not too large: no bigger than $2^{63}-1$ on a 64-bit system or $2^{31}-1$ on a 32-bit one, because Mathematica's machine integers are signed. Additionally, non-power-of-two bases require more work to get the result than just partitioning a bit-string, and are ...

2

As long as you're only counting/summing pixel values in a sliding window, you don't have to recalculate the whole sum for every pixel. You can just "count" red/black pixels in a "1x1 window" and then use a moving average or "box" filter to sum over neighborhoods. First calculate two images where every red/black pixel is 1, other pixels 0: image = ...

2

This answer is effectively a generalization of the approach by halirutan and Pickett. Here, I present a function that when given a list of colors, a list of positions and colors, or a color gradient known to ColorData[], it yields a listable compiled function effectively equivalent to Blend[]: makeCompiledBlend[colors : (_String | _List), opts___] := ...

2

Update It might be worthwhile just specifying PlotPoints. For instance, if we use Energies[_, _, x_, y_] := SparseArray[ {Band[{1, 2}] -> Cos[x] Sin[y], Band[{2, 1}] -> Cos[x] Sin[y]} , {3, 3}] as our set of test-matrices, then Plot3D[Evaluate @ Sort @ Eigenvalues @ Energies[W, q, x, y] , {x, 0, 1}, {y, 0, 1} , PlotPoints -> 10] ...

Only top voted, non community-wiki answers of a minimum length are eligible