There are basically two ways of sequentially accessing every cell of a cube of data. At first glance, drilling and slicing appear to be the same thing depending on how you are "facing" the cube, but actually can make a difference in terms of processing speed.
Let's say we have a cube 99 x 99 x 99 (X, Y & Z). I think it's safe to assume most people view the X coordinate as Horizontal, the Y coordinate as Vertical and the Z coordinate as Depth. I use a cube similar to this in HA! (with different dimensions) when storing my dungeon maps.
Slicing the data implies searching left to right, top to bottom, front to back... 1 layer at a time, or in my case, 1 dungeon level at a time. Drilling the data implies searching front to back, top to bottom, left to right... effectively punching a straight line through the cube from near to far.
Now before you start emailing me to tell me I'm an idiot and that they are the same thing, just from different facings... hear me out. First of all, you're right, but there's a catch. When slicing the cube, you are actually working against the preferred access method of your data cube.
VB.NET defines arrays in row order, meaning that the members of the right-most index are stored adjacently in memory. Your CPU cache will work WAY more efficiently than if it has to read data from non adjacent memory locations. When we use the right-most (Z) index, we are drilling through the cube and accessing memory in a CPU cache friendly manner. This result in much faster reads.
' arrTest is a 3D array: (99, 99, 99)
' Drilling
dStart = Timer
For intx = 0 To 99
For inty = 0 To 99
For intz = 0 To 99
arrTest(intx, inty, intz) = "a"
Next
Next
Next
dEnd = Timer
' Scraping
dStart = Timer
For intz = 0 To 99
For inty = 0 To 99
For intx = 0 To 99
arrTest(intx, inty, intz) = "a"
Next
Next
Next
dEnd = Timer
On my machine, the results were pretty clear. Drilling took 0.015 seconds and scraping took 0.109 seconds to access the exact same data. That's a difference of roughly tenfold. The span between a hundredth of a second and a tenth of a second may not seem like much, but if it's a commonly accessed routine, times a few thousand simultaneous users (in a web app for example), it adds up quick.
Accessing your data in this fashion requires visualizing your data from a slightly different perspective, but if you can wrap your head around it, your CPU cache will thank you.