Iterate in address order, avoid sorting PtrMap
commit91c6e93de67e233a0df9866fdea033a567932c5e
authorEdwin Smith <smith@fb.com>
Thu, 22 Dec 2016 16:57:04 +0000 (22 08:57 -0800)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Thu, 22 Dec 2016 16:58:31 +0000 (22 08:58 -0800)
treefb6f385db02764af7a8bf501aa7768c6227fce89
parente259cd807abec532635c225f4a042527c10b184d
Iterate in address order, avoid sorting PtrMap

Summary:
Before a collection starts, we initialize a PtrMap with all
the ranges of heap objects, then sort it, which can be expensive
since PtrMap can be large (>1M entries). However, most of the
entries in PtrMap come from slabs, so if we sort slabs (and big
objects) first, then iterate, we can build PtrMap in address order.

Reviewed By: kodafb

Differential Revision: D4348514

fbshipit-source-id: e2e21321e1e1508a72af26df6526ebac536a272f
hphp/runtime/base/heap-collect.cpp
hphp/runtime/base/memory-manager-defs.h
hphp/runtime/base/memory-manager.cpp