Recent large eddy simulations have led to improved parameterizations of the effective roughness height of wind farms. This effective roughness height can be used to predict the wind velocity at hub-height as function of the geometric mean of the spanwise and streamwise turbine spacings and the turbine loading factors. Recently, Meyers and Meneveau used these parameterizations to make predictions for the optimal wind turbine spacing in infinitely large wind farms. They found that for a realistic cost ratio between the turbines and the used land surface, the optimal turbine spacing may be considerably larger than that used in conventional wind farms. Here, we extend this analysis by taking the length of the wind farm, i.e. the number of rows in the downstream direction into account and show that the optimal turbine spacing strongly depends on the wind farm length. For small to moderately sized wind farms, the model predictions are consistent with spacings found in operational wind farms. For much larger wind farms, the extended optimal spacing found for infinite wind farms is confirmed.