compiler optimisations
introduce a prefix trie, with thanks to https://github.com/jdkoftinoff
optimisation: reduce # paths by de-duping input chars