Subject: [Instant-dev] About signature and hash

From: "Martin Sandve Alnæs" <[email-masked]>
Date: Mon, 1 Sep 2008 18:43:34 +0200

Actually, since the hash code of an object isn't required to be
unique, hash(signature) and signature.__eq__ is good enough for
in-memory cache, but not for disk cache. If Instant takes a
user-defined signature to be used with the disk cache, it must be a
unique string since it's used in filenames.

Technically, md5 sums aren't unique either, but it's probably much
safer than "any hash code".

--
Martin

---

From: Anders Logg <[email-masked]>
Date: Tue, 2 Sep 2008 09:35:40 +0200

> safer than "any hash code".

Yes, we need to cache on both the object (in memory) and the signature
(on disk).

We could have something like the following (in a form compiler):

  def jit(form):

      # Check module cache for object
      module = instant.get_module(object=form)
      if not module is None:
          return module

      # Check module cache for signature
      signature = form.signature()
      module = instant.get_module(signature=signature)
      if not module is None:
          return module

      # Generate code and build module
      code = compile(form)
      return instant.build_module(code)

-- 
Anders