unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: "Linus Björnstam" <linus.bjornstam@veryfast.biz>
To: lloda <lloda@sarc.name>, guile-devel <guile-devel@gnu.org>
Subject: Re: [PATCH] Add string-replace-substring to (ice-9 string-fun)
Date: Mon, 06 Jan 2020 10:08:28 +0100	[thread overview]
Message-ID: <7f2a676f-6d79-44e2-854d-06fc30d2aeba@www.fastmail.com> (raw)
In-Reply-To: <27656CBA-297B-4EE3-93D6-FD56BFBDDC44@sarc.name>

Did you try it with a "better" string-contains? IIRC the guile one is a naive string search (but in C) which could maybe be better if it was implemented as, say, a KMP search. The reference srfi-13 has one you could try. That could be faster for longer strings and longer patterns. 

If that is faster, I can port a constant-space one that I have in ocaml somewhere in the catacombs of my.computer.

-- 
  Linus Björnstam

On Fri, 20 Dec 2019, at 18:32, lloda wrote:
> 
> This patch adds string-replace-substring that wingo posted to the 
> mailing list to (ice-9 strings). This is a commonly used function and a 
> good implementation isn't trivial, so I think it deserves inclusion.
> 
> 
> 
> Attachments:
> * 0001-Add-string-replace-substring-to-ice-9-string-fun.patch



      parent reply	other threads:[~2020-01-06  9:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20 17:32 [PATCH] Add string-replace-substring to (ice-9 string-fun) lloda
2020-01-05 11:34 ` Andy Wingo
2020-01-05 12:12   ` Jan Nieuwenhuizen
2020-01-05 13:51     ` Christopher Lam
2020-01-05 15:49       ` Arne Babenhauserheide
2020-01-05 14:01     ` lloda
2020-01-05 23:40       ` David Pirotte
2020-01-06  9:08 ` Linus Björnstam [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f2a676f-6d79-44e2-854d-06fc30d2aeba@www.fastmail.com \
    --to=linus.bjornstam@veryfast.biz \
    --cc=guile-devel@gnu.org \
    --cc=lloda@sarc.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).