The growing complexity of processors has made the generation of efficient code increasingly difficult. As a result, hand-tuned code can be orders of magnitude faster than compiled code. To address this problem library generators such as ATLAS, FFTW, or SPIRAL use empirical search to find the parameter values such as tile size or degree of unroll that deliver the best performance for a particular machine. In this talk, I will present our experience in the generation of an adaptive sorting library for sequential and parallel machines, and discuss the issues that appear when applying this technology for the automatic generation of libraries for parallel machines.