Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

chaoticset (2105)

  (email not shown publicly)
AOL IM: chaoticset23 (Add Buddy, Send Message)
Yahoo! ID: illuminatus_foil (Add User, Send Message)

JAPH. (That's right -- I'm not Really Inexperienced any more.)

I'm not just here, I'm here [], and here [] too, I ramble randomly in my philosophical blog [] and my other blog []. Soon I'll come in a convenient six-pack.

Journal of chaoticset (2105)

Thursday October 16, 2003
03:29 PM

Palindromy IV: Time Is Not On My Side

[ #15243 ]
I stuck a couple of counters and such into the code so that I could try to determine where it slows down, and found that it gets slower as time goes by. I suspect the size of the hash it's inserting into is the problem, not the basic processing time.

To that end, I'm considering using a database to hold the results, in case this thing will actually be fast enough that way. I'm not 100% this is going to work -- it's going to add the overhead of DBI to the mix -- but it's better than giving up.

If I'm overlooking something obvious, I'd love to know it.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Perhaps using a nested array that indexes one character at a time would help. Each array would have a counter (to count the number of words that matched this far in) and 26 refs to additional arrays. There would be 3 starting arrays - one counts words that begin with a substring, one counts words that end with a (reversed) substring, and one counts words that contain a substring. The following does this. (However, this code does not tell you which words can be used to provide a traversal - the reversible