Revert "Revert "Merge pull request #4633 from thestinger/treemap""

This reverts commit d73077f82dc0f074f7abcb017bd73f4d70a685e9.
Revert readline optimization and add test
core: Move rt to private