guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HTTP GET Shakespeare


From: Ralf Mattes
Subject: Re: HTTP GET Shakespeare
Date: Sat, 22 Aug 2015 22:01:30 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Sat, Aug 22, 2015 at 03:07:24PM -0500, address@hidden wrote:
> Hello list, I need some help.
> 
> I'm following a Computer Science course material in Python and then try to
> implement the examples and exercises in Guile Scheme.
> 
> Currently I'm working on a small program to get a text document from the Web
> and do some string operations with the content, but my implementation in
> Guile takes about 5-7 minutes to finish, while the Python version takes 6-8
> seconds. Also, the printed results are different, but I'm more concerned
> about the time issue right now.
> 
> Could you point me to possible mistakes I'm making here?
> 
> Guile Scheme program:
> https://gist.github.com/umanomata/99f103ed686acd523d9e

Hmm - only a quick look but delete-duplicates might be the guilty part here -
looking at the (C) code in libguile/srfi-1.c it seems the implementation 
builds up a list of results and needs to scan that list for every new item in
the source list. To be fair, the docstring mentiones:

 In the worst case, this is an @math{O(N^2)} algorithm ...

One might be tempted to use some kind of hashing data structure here ;-)

 HTH Ralf Mattes

> Python program:
> https://gist.github.com/umanomata/1dbb3beb2ce19f09fcee
> 
> Thanks,
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]