News for hackers. Stuff that matters.
Re:SQLite small blob storage: 35% Faster Than the Filesystem by the8472 on Wednesday June 14, 2017 @01:39PM (#14554427)
ext4 uses btrees for the directory index, so accessing files by name is just as fast as manually splitting it into a prefix-based directory tree.

Searching by filename on the other hand can be much faster with a prefix tree because directories only allow linear scans, not range-based ones.

Re:SQLite small blob storage: 35% Faster Than the Filesystem by ngrilly on Wednesday June 14, 2017 @04:05PM (#14555661)
I'm missing something. What difference do you see between "accessing files by name" and "searching by filename"?
Re:SQLite small blob storage: 35% Faster Than the Filesystem by the8472 on Wednesday June 14, 2017 @04:46PM (#14555993)

    f = open("/path/to/file");
    // do something with file
vs.

    d = opendir("path/to")
    while((dent = readdir(d)) != NULL) {
       if(!dent.name.startsWith("file"))
          continue;
       // do something with first matched entry
    }

The former is O(log n) on ext4, O(n) on older filesystems that use flat lists.

The latter is always O(n)

Re:SQLite small blob storage: 35% Faster Than the Filesystem by ngrilly on Wednesday June 14, 2017 @05:01PM (#14556092)
Understood. Thanks ;-)