I'll need to see some numbers to back up that statement, please. If you
look at the graphs produced by LMbench, they tell you exactly what
you need to know. It's true that for very small files, 8K and under,
using read() to access them is faster than using mmap, due to the extra
work of setting up and tearing down the mapping. To quantify this, a
4KB open/read/close is 500MB/sec, but an open/mmap/access/unmap/close
is 425MB/sec. By the time we hit 16K, mmap wins by 15% and just gets
better from there.
And that all assumes you are doing large reads, which in db code you
are not. So mmap will look better even on the small files if you
are doing little DB style accesses.
> For basic db hash usage and raw speed
> nothing seems to touch tdb (Tridge's db hack).
Taking nothing away from Tridge, I like Tridge, I'd like to see numbers.
I'm sure that Tridge's stuff is great, but we were very motivated to
go well beyond the normal effort when we wrote this code.
A multithreaded version of the code that I sent to Keith was doing 455,000
lookups/second on an 8way 200Mhz R4400 SGI box in 1996. Each lookup
was locked. If you assume perfect scaling (it was) and you assume the
locks took 0 time (they didn't), that's 1.75 usecs for each lookup.
On a machine with horrible memory latency and a large dataset.
We designed the MDBM code to be scalable (its 64bit clean), portable
(runs on 20+ platforms today), multiplatform (metadata is stored in
network byte order on disk), and fast (we knew exactly what the
instruction and data cache footprint was for hot cache, and we made
sure that you did at most 2 disk accesses, 1 was typical, to get at
any item in a cold cache).
SGI uses this code for their name server, every process mmaps the
name server cache.
We use this code all over BitKeeper.
> Its also portable code which
> is important since the tool has to be built on the compiling host.
The code works on Windows, MacOS X, and basically all Unix platforms.
Yeah, yeah, I pounding my chest and I'm sorry, but I get beat up all the
time that the BK license doesn't let you reuse code and this code is part
of BK that we broke out and licensed under the GPL. The point being
that if there is reusable code in BK, we're willing to let people use
it under whatever license they want. It would be nice if that actually
happened after all the yelling and screaming.
----- Larry McVoy lm at bitmover.com http://www.bitmover.com/lm - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to email@example.com More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/