greatly improve the performance of nameSort

The current implementation was tokenizing the names to do the
comparison. Replace by a much simpler character-by-character
comparison function.

It has a direct impact on everything that adds lots of types,
such as import and merge operations.