HSEARCH-1260 and memory improvements for branch 4.5

It's still missing documentation updates but I'll work on that in parallel, so the technical review could start already.

I'll send a separate pull request for master so that I can incorporate eventual comments in both branches.

About HSEARCH-1486: let me know if someone is interested in seeing some graphs.. it's probably hard to believe - at least it was very surprising to me - but this patch makes a huge difference.