On Mon, 22 Mar 2004 14:35:23 -0500, "Doug Currie" <[EMAIL PROTECTED]> said:
> It has no way of knowing (save diffing the db) that "there have been > no write transactions." well, that should in principle be easy to accomplish, shouldn't it? For example by having any writer increment a counter held in the meta information in the first page of the file (PageOne or whatever). > > While I'm making suggestions despite near-total ignorance > > of sqlite :), have you measured what improvement would > > be obtained by using readonly mmap() for readers, rather > > read()? It would save some malloc churning as well as > > a memory copy. Performance could be additionally tweaked > > with madvise(SEQUENTIAL) when suitable. > > These functions are not in ANSI C. No, but they are POSIX. And there are lots of functions already in the sqlite code base that are neither ANSI nor POSIX (primarily for windows or mac). There are several operating systems, such as Solaris that implement their "cp" using mmap rather than read, and have done so for ages. So this is really not some piece of exotica. There probably are some embedded systems that do not offer mmap. There are circumstances when mmap will not perform as well as read. For example, the sqlite case of using a page only once is pessimal for mmap, because of TLB bookkeeping overhead on setup and unmapping. Use of mmap would probably make sqlite even more vulnerable to NFS than it is already. I would not suggest mmap as the only solution; as with web servers, I would suggest the strategy as a configurable option. Also, even I would hesitate over suggesting mmap for writers, without a lot of experimentation. On Mon, 22 Mar 2004 14:56:35 -0500, "D. Richard Hipp" <[EMAIL PROTECTED]> said: > Mark D. Anderson wrote: > > Have you measured what improvement would be obtained by using readonly mmap() > > for readers, rather read()? > > SQLite supports files that are larger than 4GB. I don't think > you can mmap() a file that big on a machine with a 32-bit > address space. You'd have to use mmap64 for that, if it was desirable to use mmap at all. -mda --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]