The locality claim, measured
The reason anyone uses a Hilbert curve instead of simply reading a grid row by row is locality: points that are close together in 2-D should end up close together along the 1-D path. It is why Hilbert order shows up in database indexes, image compression, cache layouts and IP-address maps.
So measure it. For every pair of cells that are neighbours on the grid, take the distance between their positions along the curve, and look at the whole distribution. The table updates with the order you have selected:
Hilbert wins on the median and loses on the mean
At order 8 — a 256×256 grid, which is the size the measurement below was run at — the Hilbert curve has a median neighbour gap of 1 against row-major’s 128.5. That is the famous result, and it is real: most of the time, a step on the grid is a step or two along the curve.
Then look at the mean. Hilbert’s is 155.6; row-major’s is 128.5. The curve everyone reaches for because it preserves locality is, on average, worse than reading the grid in rows. The worst case is not close: Hilbert’s largest neighbour gap is 54,613, row-major’s is exactly 256, and it can never be anything else.
The two facts are not in conflict. Row-major is uniformly mediocre — every horizontal step costs 1, every vertical step costs exactly the width, and there is no tail. Hilbert is excellent almost everywhere and catastrophic at the seams between its recursive quadrants, where two cells that touch on the grid sit at opposite ends of the path. Averages are pulled around by those seams; medians are not. The full measurement is here.
Which one you should care about depends entirely on what the cost function is. If a distant neighbour means a cache miss, the median is what matters and Hilbert is the right choice. If it means a disk seek whose cost scales with the distance, the mean is what matters and row-major is competitive. “Preserves locality” is not a property you can use without saying which statistic you meant.
What the other three are
Z-order, also called Morton order, interleaves the bits of the x and y coordinates. It is far cheaper to compute than Hilbert — a couple of bit tricks with no recursion — which is why it is what most database indexes actually use. The price is visible in the picture: the path jumps across the whole grid at every power-of-two boundary, and the numbers show it.
Boustrophedon is row-major with every second row reversed, so the path never jumps back to the left edge. It is what a plotter or a 3-D printer does when filling a solid region, and it fixes row-major’s one visible flaw at zero cost — but only for the horizontal direction.
Exporting for a plotter or a cutter
Save SVG writes the curve as a single continuous polyline in a 1000-unit square, with no fills and no groups. That is the shape a pen plotter, a laser cutter or a CNC router wants: one path, drawn without lifting. Order 6 gives 4,096 points, which most machines handle comfortably; order 8 gives 65,536 and will make some of them think about it.