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: Kevin Wortman
Subject: Re: [Chicken-users] how to speed up my text filter?
Date: Tue, 24 Sep 2013 21:39:04 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8

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




reply via email to

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