[plt-scheme] Re: Using PLT Scheme libs elsewhere?

From: SpinyNorman (jmcaxolotl at gmail.com)
Date: Fri May 18 09:48:47 EDT 2007

Thanks for the response.

As for the version of PLT Scheme, I may need some education.  I am
using DrScheme, and the version currently offered for download is
360.  Is it the case that version 369 of PLT won't work w/DrScheme, or
that there's a secret handshake required to persuade it?  (I haven't
found where it lives either, but I presume it should be pretty easy to
find. (?))

Second question: For evaluating speedup, I can use the crude eye-hand-
stopwatch method of course, but I believe there is a library function
for timing executions; I'm not sure of its name.  Clue?



On May 18, 4:18 am, Jens Axel Søgaard <jensa... at soegaard.net> wrote:
> Hi,
>
> SpinyNorman wrote:
> >Share?  I'm flattered.  Here it is, and my only claim at this point is
> >that hey, it works.  Algorithmic insights are more than welcome.
>
> >(require (lib "md5.ss"))
>
> This md5.ss implements MD5 in Scheme. The Java MD5 is probably
> implemented in C.
> So if you switch to a C-based MD5 implementation, you'll get a speedup.
> Here is
> what to do:
>
> (require (planet "digest.ss" ("soegaard" "digest.plt" 1 2)))
> (require mzscheme)
>
> (define test-string (make-string 10000))
>
> (define (md-file-chunks port chunk-size)
>   (let loop ()
>     (begin
>       (display (md5 (read-bytes chunk-size port)))
>       (newline))
>     (if (not (eof-object? (peek-byte port)))
>     (loop))))
>
> (md-file-chunks (open-input-string test-string) 1024)
>
> See
> <http://planet.plt-scheme.org/display.ss?package=digest.plt&owner=soeg...>
> for documentation.
>
> This was tested on Windows, but ought to work elsewhere too.
> You'll need a relatively new version of PLT Scheme, for
> example 369.100.
>
> It wasn't obvious whether you put the md-file-chunks in a module or
> whether you are using the top-level. If you are using the top-level,
> the line
>
>     (require mzscheme)
>
> makes sure primitive operations are inlined.
>
> I'd love to hear your new timings.
>
> PS: Remember to close file ports after use.
>
> --
> Jens Axel Søgaard
>
> _________________________________________________
>   For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.