← Back to team overview

instant team mailing list archive

Re: md5 deprecated

 

On Mon, Sep 01, 2008 at 03:21:55PM +0200, Martin Sandve Alnæs wrote:
> 2008/9/1 Kent-Andre Mardal <kent-and@xxxxxxxxx>:
> > On ma., 2008-09-01 at 14:09 +0200, Martin Sandve Alnæs wrote:
> >> 2008/9/1 Anders Logg <logg@xxxxxxxxx>:
> >> > On Mon, Sep 01, 2008 at 01:54:09PM +0200, Martin Sandve Alnæs wrote:
> >> >> 2008/9/1 Anders Logg <logg@xxxxxxxxx>:
> >> >> > On Mon, Sep 01, 2008 at 01:07:33PM +0200, Martin Sandve Alnæs wrote:
> >> >> >> Another suggestion for the TODO list (but not on the top!):
> >> >> >> - Implement in-memory cache for already imported modules (based on signature)
> >> >> >>   I.e. a global dict on the form
> >> >> >>   _module_cache = { "module signature": previously_compiled_module }
> >> >> >>   which is looked up transparently.
> >> >> >
> >> >> > It should not need to be mapped specifically from a signature, but
> >> >> > should work for everything that is hashable (which means we can just
> >> >> > use a dictionary).
> >> >> >
> >> >> > FFC keeps a module cache based on the form object (since computing the
> >> >> > signature may sometimes take time).
> >> >> >
> >> >>
> >> >> Computing repr(form) + repr(options) shouldn't take much time?
> >> >
> >> > Yes, it does. At least it is noticeable for some forms.
> >> >
> >> >> Anyway, the signature in question here may be a signature passed
> >> >> by the user (e.g. FFC), i.e. it can be a hash string of anything you want.
> >> >
> >> > Does it have to be a string? I'm just saying Instant doesn't need to
> >> > know what it is, as long as it's hashable.
> >> >
> >>
> >> Ok.
> >>
> >
> > So the cache should be:
> >
> >
> > module_cache [hash(whatever)] = whatever
> >
> > where whatever might be a signature or something different ?
> >
> > Kent
> 
> Almost:
> 
> module_cache [hash(whatever)] = module_compiled_with_given_whatever_id_object
> 
> whatever can e.g. be the UFL form, which instant doesn't know how
> relates to the code.

It should be enough to do

  module_cache[whatever] = module_compiled_with_given_whatever_id_object

-- 
Anders

Attachment: signature.asc
Description: Digital signature


Follow ups

References