Implement comparator for «improve-basic-order» the right way

do we need some performance testing here?

Signed-off-by: Daniel Borchmann <daniel.borchmann@mailbox.tu-dresden.de>