The gridding of spectra is done in CLASS with 2 commands and 3 files involved:
If the input table and the output cube fit both in memory at the same time, the command XY_MAP will read and write them at once: this is the ideal and most efficient case.
On the other hand, for larger datasets, the command splits the problem in slices of velocities (contiguous channels). With the way the input and output files can be ordered by default on the disk, reading or writing one slice may imply traversing entirely a file, and to repeat this process each time for each slice. This is known to decrease strongly the efficiency of the command XY_MAP.