Thanks, Richard, it worked. For cases when I want to get benefits of faster
file-mapping I did some adjustment.

Btw, this was also for a small tool I use. It's similar to how
defragmenters show sectors while doing the job. In this case the sectors
are pages of sqlite file. If a sector was read I draw a pixel and this
works as animation while a query is being executed. So for my query that
worked 27 seconds with 3.7.16.1 and 9 seconds for 3.7.17.draft, the reading
pattern a exactly the same, virtually random filling half of the area of a
32MB file. Looks like file caching is very conservative in guessing what
can be used around in the future, while file-mapping routines assumes wider
ranges around. Sure, after both queries if I don't reset the cache, the
repeated query is almost instant.

Max



On Mon, Apr 8, 2013 at 4:31 PM, Richard Hipp <d...@sqlite.org> wrote:

> On Mon, Apr 8, 2013 at 8:20 AM, Max Vlasov <max.vla...@gmail.com> wrote:
>
> > Richard,
> >
> > It makes sense, but I see here some possibility of future confusion.
> > Correct me if I'm wrong. Currently if I have a vfs that requires special
> > preparations (for example, decompression), I have two choices, either
> > provide V2 interface or emulate memory-mapping by allocating my own
> blocks
> > of memory in xFetch and deallocating in xUnfetch. If future V4 IO
> routines
> >
>
> You an implement xFetch to always return NULL:
>
>     int xFetch(sqlie3_file *pNotUsed1, i64 notUsed2, int notUsed3, void
> **pp){
>       *pp = 0;
>       return SQLITE_OK;
>     }
>
> Then SQLite will always fallback to doing plain old xRead and xWrite.
>
>
>
> > introduce something new, one will not have the first option. So anyone in
> > the future should be aware that there are two points where data can be
> > needed and since one expects filling previously allocated block and
> another
> > expects pointer to the data, the complexity of understanding will grow.
> Or
> > is there a simple way to disable xFetch/xUnfetch on the VFS level?
> >
> > Max
> >
> >
> >
> >
> >
> > On Mon, Apr 8, 2013 at 3:33 PM, Richard Hipp <d...@sqlite.org> wrote:
> >
> > > On Mon, Apr 8, 2013 at 6:12 AM, Max Vlasov <max.vla...@gmail.com>
> wrote:
> > >
> > > > But I also noticed that if I provide
> > > > version 2 of vfs, I won't get benefits of file-mapping
> > > >
> > >
> > > That's how we implement backwards compatibility to legacy VFSes.
> > >
> > > --
> > > D. Richard Hipp
> > > d...@sqlite.org
> > > _______________________________________________
> > > sqlite-users mailing list
> > > sqlite-users@sqlite.org
> > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > >
> > _______________________________________________
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to