Maybe you could use the usort approach with a post-pass to check that it's a list of pairs, to preserve the semantics while still speeding it up significantly for large lists.