|
From: | Xin Zheng |
Subject: | Re: [Chicken-users] how to speed up my text filter? |
Date: | Wed, 25 Sep 2013 12:17:49 -0400 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |