Open FND opened 10 years ago
Just for a quick test I would see what happens if you stub out the call to run
. That fork may be expensive.
You might be right: The offending line is
https://github.com/FND/tiddlywebplugins.gitstore/blob/379033f4d5704f3f14c5cb3d0c6422dcfaefe2b1/tiddlywebplugins/gitstore/__init__.py#L81-82
(this affects tiddlers listings because tiddler_get
is being called)
However, it's not the forking that's slow, but Git itself:
$ time git log -n1 --format=%H -- bags/bookmarks/tiddlers/helloworld
e4de29934938cc5cec481207aaec3b5ee29d2cd0
real 0m0.592s
user 0m0.537s
sys 0m0.057s
That kinda sucks...
After a fair amount of consideration:
It appears the only viable solution is to store the respective commit hash on write (e.g. as tiddlers/.rev/$title
), though it's important to allow users to modify the filesystem directly without additional complexity:
Delegating the writing of
.rev/$title
to a Git post-commit hook would allow users to continue to modify the repository as before - only the actual federation would be more complex as revs would have to be updated post-pull (on account of being untracked - though perhaps they don't need to remain so?).
actually though, due to tagdex, modifying the store directly can lead to inconsistencies - so we might additionally store the last known commit, check whether there were any new commits and recalculate the caches/indexes for everything after that
loading /bags/tiddlers/bookmarks for a bag with ~1200 tiddlers takes several minutes, with occasional CPU spikes from Git
in fact, even loading a single tiddler (page) takes unusually long:
seems like an issue with gitstore - IIRC it queries Git for the latest revision rather than just reading from the filesystem (which might have uncommitted changes)
ticketing here to make sure it actually gets looked at