I guess one of the reasons is that you are creating a new db transaction each time __getitem__ gets called. That will be a lot of overhead.
Also, sequentially loading the items using an iterator (as done in caffe) will be faster than using f.get(key), but current Dataset API doesn’t seem to support iterator…