reduced malloc overhead on neighbour searching