chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] how to speed up my text filter?


From: Xin Zheng
Subject: Re: [Chicken-users] how to speed up my text filter?
Date: Wed, 25 Sep 2013 12:17:49 -0400

I cannot find "for-each-line" in utils unit of 4.8.04. I am guessing it's removed from the new release?
Thanks,
Xin


On Wed, Sep 25, 2013 at 12:39 AM, Kevin Wortman <address@hidden> wrote:

It looks like the only part of the (process ...) procedure that does any
significant allocation is the
(string-split line "\t")
_expression_, which will allocate a string object and linked list node for
for every token. However you don't really need those objects; all you
need is to see whether the ref field starts with * and in that case
print the id field and nothing else.

It may be faster to use a regular _expression_ (
http://wiki.call-cc.org/man/4/Unit%20irregex ) to search for a matching
id field, and if and only if a match is found, retrieve the matching id
field with irregex-match-substring.

Also note that I think you can simplify your main loop down to:

(for-each-line process in)
(write-line "done" (current-error-port))

using the utils unit (
http://wiki.call-cc.org/man/3/Unit%20utils#for-each-line ).

Kevin Wortman


_______________________________________________
Chicken-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/chicken-users


reply via email to

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