![]() |
|
Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: simple string comparison for efficiencyby etj (Priest) |
on Nov 17, 2024 at 17:17 UTC ( [id://11162765]=note: print w/replies, xml ) | Need Help?? |
I'd use PDL, with some overly-clever finagling to maximise locality:
Yes, I enjoy that in the third bit, "any" sounds like the normal pronunciation of "ne". I'm only human. If you want to make a custom transformation that does loop-fusion manually, see the SYNOPSIS of Inline::Pdlpp for an also-bio-inspired example. Edit: if one chooses to not loop-fuse, the ne produces a mask that is true for any non-matches; that can then be fed into which to give the positions of those. Edit 2: the above should take a matter of minutes to write, which would be much quicker than writing it in C/C++, and should run pretty quickly. But the naive, 2,1e8 solution has the benefit of broadcasting, which would mean it would also benefit from auto-pthreading, which in C/C++ would be a lot of hard work.
In Section
Seekers of Perl Wisdom
|
|