Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Fast Identification Of String Difference

by BrowserUk (Pope)
on Jan 17, 2011 at 09:12 UTC ( #882633=note: print w/replies, xml ) Need Help??


in reply to Fast Identification Of String Difference

I would like to find position and character in in $s1 where it differs with $s2. In this case the answer would be:

What are you going to do with the information once you have it?

I mean in the program that is discovering it. Ie. Are you going to write it to disk or utilise it within the program for some further processing?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re: Fast Identification Of String Difference

Replies are listed 'Best First'.
Re^2: Fast Identification Of String Difference
by neversaint (Deacon) on Jan 18, 2011 at 00:59 UTC
    Dear BrowserUK,
    Store in memory for further processing.

    ---
    neversaint and everlastingly indebted.......

      Could you give us more information about what processing you are going to do?

      For example:

      • Will you use each triplet of data (c1,c2,p) in isolation?
      • Or do you need all the triplets from a given pair of strings all together?
      • Or do you need the triplets from different pairs of strings together?

      The reason for these questions is that whether done in Perl or C allocating the memory in which to build the list of positions is a substantial part of the overall cost. If you only need each position in isolation, then an iterator interface might be more efficient to use.

      Equally, are the pairs of strings you are comparing the same length? Or are you comparing short strings with (every?) substring of a large strings? Are you comparing many short strings against (every) substring of larger strings?

      The problem is that the basic mechanics of comparing the characters in two string is very fast. Especially in C. But the details of the code that surrounds that can have a big impact on the overall application time.

      Rather than an extended to'n'fro of questions, it would be easier if you posted code or pseudo-code of the actual application, along with numbers and sizes of the strings involved.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://882633]
help
Chatterbox?
[stevieb]: I've finally added the ability for berrybrew to fetch the list of perls available directly from Strawberry's releases.json file. Instead of pulling from there on every single call, I've added a berrybrew fetch, so it's only updated..
[stevieb]: ...on request. There's some supporting work I need to do, as well as update the docs, but it's in the v1.12 branch if anyone wants to play with it...
[stevieb]: ...issue 62 will track what else needs to be done.

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2017-03-31 01:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (364 votes). Check out past polls.