From: Andrew Myrick <amyrick@apple.com>
To: git@vger.kernel.org
Cc: Sam Vilain <sam@vilain.net>, Eric Wong <normalperson@yhbt.net>
Subject: git-svn: persistent memoization
Date: Tue, 19 Jan 2010 15:37:01 -0800 [thread overview]
Message-ID: <26542E21-CAF5-4ACD-B9DC-1981AE41F50C@apple.com> (raw)
git-svn uses the Memoize perl module to cache the return values of a few functions. This speeds up svn:mergeinfo processing considerably, but as currently implemented, this memoization table must be reconstructed on every run of git-svn. This isn't a problem on small projects, but it introduces a delay of several minutes when fetching from large repositories with a lot of merge info.
The Memoize module has support for storing its cache persistently (more below, and see http://perldoc.perl.org/Memoize.html for details), and I would love to take advantage of this support in git-svn. Unfortunately, it's not entirely obvious to me how to get this working. Here are the questions I have so far, moving from high level design questions to implementation details:
1) Is there any reason not to store these caches on disk?
2) Are there situations where the caches would need to be invalidated? Perhaps when git-svn rebuilds its metadata?
3) Where should I put these caches? I was thinking something like ".git/svn/caches/<cachefile>.db" would be appropriate.
4) What's the correct way to reference the path to those caches? I tried using "$ENV{GIT_DIR}/svn/caches/has_no_changes.db", but the memoize calls are in a BEGIN block, and it seems that $ENV{GIT_DIR} hadn't been initialized at that point. This has taken me way past my limited knowledge of Perl.
5) What backend should I pick to store the cache? Memoize supports storing to any tied hash that supports TIEHASH, FETCH, STORE, and EXISTS, like DB_File. It also supports storing to SDBM_File and NDBM_File through glue modules (they lack EXISTS support), and Storable, which isn't a tied hash at all, but just a serializer for hashes. I'm leaning towards using Storable since it seems simple and would fit the workload well, but I would appreciate any insight from someone with more domain knowledge here.
Regards,
Andrew
reply other threads:[~2010-01-19 23:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=26542E21-CAF5-4ACD-B9DC-1981AE41F50C@apple.com \
--to=amyrick@apple.com \
--cc=git@vger.kernel.org \
--cc=normalperson@yhbt.net \
--cc=sam@vilain.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox