Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.forth Subject: Re: Forth dictionary implementation and performance Date: Sun, 31 Jan 2016 11:57:50 -0800 Organization: A noiseless patient Spider Lines: 19 Message-ID: <8737tdr075.fsf@jester.gateway.pace.com> References: <2016Jan29.184253@mips.complang.tuwien.ac.at> <87k2mrrk95.fsf@jester.gateway.pace.com> <2016Jan30.145442@mips.complang.tuwien.ac.at> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="560a36ee31cc4bcf69e115b311f0cc5c"; logging-data="27167"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+uGwn4vVXLFbOUdQ+4GGvP" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:JEZCEPeVIyEcXr642MoMu0flta4= sha1:GQwh3PoFCuOQ51c86XqYHHh+QMI= Xref: csiph.com comp.lang.forth:45219 anton@mips.complang.tuwien.ac.at (Anton Ertl) writes: > Note MAP_PRIVATE; from the documentation: "Updates to the mapping are > not visible to other processes mapping the same file, and are not > carried through to the underlying file." Hmm, I remember noticing that, but it didn't seem to displace the part saying opening the file for read/write was required for PROT_WRITE. I asked on #linux IRC and someone there said it was undefined behaviour under POSIX, so I'd be scared to deploy it in anything serious, but anyway it seems to work for the example. > in other words, mmap() is used here as (a hopefully more efficient > variant of) read(). Yes, that part made sense. Though reading the file in a single read() call might conceivably be faster than mmap'ing the file and taking multiple page faults while traversing it. I think the next thing after that is to use AIO to know which pages are available at a given time. For such a small file I doubt any of this makes any difference, though.