Anyone know where I can get at the examples of Inline that were provided
   at the tech meeting? Against the good sense of others at the meeting, I'd
   like to try some simple regex compilations and compare their performance,
   using Inline. All of the inline.pm source code online seems to be targeted
   at static code, and I'd like to just reuse the examples you provided of
   dynamic code that md5-hashed itself, etc.

There is a link to the slide source at the bottom of
  http://www.vendian.org/mncharity/dir3/inline/
Please take the examples with a kilo of salt -- most were `talk in a
few hours' write-only slide spewage ("having not been tested, it does
not work", "having not been reviewed, it doesn't even try").

Md5 is used for symbol creation in two contexts.  First, to help
generate a unique function name for dynamically linking a specialized
version of a function.  One wants a uid which depends only on the rest
of the code (ie, not a counter), so you don't give Inline needlessly
different resulting code for it to cache-miss on.  Second, to generate
a simpler uid for some standin for code, with which to do your own
caching (for instance, when the C code generation step is expensive).
But this last is for debugability, not speed.

For example, given strings which define regexps, and an expensive
regexp to C code creation process, one might do both with something
like

  my $re_id = md5sum($re);
  if(!$seen{$re_id}) {
     my $function_name = "mumble_${re_id}";
     my $re_c_code = &compile_re_to_C_code(regexp => $re,
                                           function_name => $function_name);
     Inline->bind(C => $re_c_code);
     $seen{$re_id} = \&$function_name;
  }
  return $seen{$re_id}->(@_);

Cheers,
Mitchell


   Date: Fri, 15 Mar 2002 17:41:36 -0500 (EST)
   From: Michel J Lambert <[EMAIL PROTECTED]>
   To: [EMAIL PROTECTED]
   Subject: [Boston.pm] Inline Examples from Tech Meeting
   Message-ID: <[EMAIL PROTECTED]>
   X-UIDL: +V[!!*Lc!!l/)#!fhS!!

   Heya,

   Anyone know where I can get at the examples of Inline that were provided
   at the tech meeting? Against the good sense of others at the meeting, I'd
   like to try some simple regex compilations and compare their performance,
   using Inline. All of the inline.pm source code online seems to be targeted
   at static code, and I'd like to just reuse the examples you provided of
   dynamic code that md5-hashed itself, etc.

   Thanks,
   Mike Lambert


Reply via email to