On Tue, Aug 23, 2016 at 8:41 AM, Robert Haas <robertmhaas@gmail.com> wrote:
> We could test to see how much it slows things down. But it
> may be worth paying the cost even if it ends up being kinda expensive.
Here are some numbers from a Xeon E7-8830 @ 2.13GHz running Linux 3.10
running the attached program. It's fairly noisy and I didn't run
super long tests with many repeats, but the general theme is visible.
If you're actually going to USE the memory, it's only a small extra
cost to have reserved seats. But if there's a strong chance you'll
never access most of the memory, you might call it expensive.
Segment size 1MB:
base = shm_open + ftruncate + mmap + munmap + close = 5us
base + fallocate = 38us
base + memset = 332us
base + fallocate + memset = 346us
Segment size 1GB:
base = shm_open + ftruncate + mmap + munmap + close = 10032us
base + fallocate = 30774us
base + memset = 602925us
base + fallocate + memset = 655433us
--
Thomas Munro
http://www.enterprisedb.com