GithubHelp home page GithubHelp logo

Comments (10)

Bodigrim avatar Bodigrim commented on May 23, 2024 1

@Equwece you can use https://hackage.haskell.org/package/base-4.18.0.0/docs/Data-Array-Byte.html and low-level operations like https://hackage.haskell.org/package/base-4.18.0.0/docs/GHC-Exts.html#v:readIntArray-35-. You might end up implementing a small module with helper functions similar in spirit to https://hackage.haskell.org/package/text-2.0.2/docs/Data-Text-Array.html.

That said, I'd prototype with array package. If it works out well, you'll be able to migrate to low-level primitives later.

from bytestring.

dcoutts avatar dcoutts commented on May 23, 2024

Exported isSuffixOf.

We lack implementations of isInfixOf and breakSubstring. We should probably get them from the stringsearch package.

from bytestring.

Bodigrim avatar Bodigrim commented on May 23, 2024

The relevant part of stringsearch: http://hackage.haskell.org/package/stringsearch-0.3.6.6/docs/Data-ByteString-Lazy-Search.html

from bytestring.

ribosomerocker avatar ribosomerocker commented on May 23, 2024

What's the blocker here? I've just ran into this.

from bytestring.

Bodigrim avatar Bodigrim commented on May 23, 2024

@ribosomerocker No blockers, PRs welcome.

from bytestring.

ribosomerocker avatar ribosomerocker commented on May 23, 2024

Am I correct in assuming that this depends on #307 ?
This would need to have a breakSubstring implementation used in the lazy substring module. Is it fine to continue with the current implementation?

from bytestring.

Bodigrim avatar Bodigrim commented on May 23, 2024

Not necessarily: it's likely better to have at least some (non-pathological) breakSubstring for lazy ByteString than none at all. Further refinements can be done separately.

from bytestring.

Equwece avatar Equwece commented on May 23, 2024

Hi, I am trying to add a lazy variant of breakSubstring from stringsearch to solve #100 and need an advice. The code from the stringsearch actively uses (1, 2) array package, but this package is not included in bytestring's build dependencies, what can be the preferred way to solve this problem (I suppose that adding new build dependency is not an option)?

from bytestring.

Bodigrim avatar Bodigrim commented on May 23, 2024

I've been recently hit by the absense of lazy breakSubstring again.

A lazy way to implement breakSubstring for lazy ByteString is to adopt https://github.com/haskell/text/blob/master/src/Data/Text/Internal/Lazy/Search.hs. The algorithm in text has been well tested and well benchmarked, so it's a safe bet, given that it seems no one has much time to dedicate to this issue. @clyring what do you think?

from bytestring.

Equwece avatar Equwece commented on May 23, 2024

Sorry for the lack of progress on the task, I have implemented a lazy variant of breakSubstring using a self-written BoyerMoore implementation and byte array primitives similar to the text module (really appreciate @Bodigrim answer), but a quick benchmarking showed that my solution is much slower than stringsearch's solution, so I decided not to send pr yet and improve the implementation, but unfortunately I haven't found the time yet.

from bytestring.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.