Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^5: PDL: Looking for efficient way to extract sub-images, by finding bounding boxes of "objects" (FAQ6: $&)

by BrowserUk (Patriarch)
on Nov 22, 2016 at 09:19 UTC ( [id://1176317]=note: print w/replies, xml ) Need Help??


in reply to Re^4: PDL: Looking for efficient way to extract sub-images, by finding bounding boxes of "objects" (7000x faster)
in thread PDL: Looking for efficient way to extract sub-images, by finding bounding boxes of "objects"

It turns out that the reason for the pathologic behaviour of your code under 5.10 is entirely down to your use of $&, as described in the FAQ since circa 1999 or before.

Replacing my $c = ord( $& ) - 1; with my $c = ord( substr $$str, $-[0], 1 ) - 1; entirely eliminates the performance problem on 5.10.1.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
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". The enemy of (IT) success is complexity.
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^5: PDL: Looking for efficient way to extract sub-images, by finding bounding boxes of "objects" (FAQ6: $&)
  • Select or Download Code

Replies are listed 'Best First'.
Re^6: PDL: Looking for efficient way to extract sub-images, by finding bounding boxes of "objects" (FAQ6: $&)
by vr (Curate) on Nov 22, 2016 at 10:42 UTC
    Thanks. I can allow myself :) to run all my code under new versions, and disregard performance issues of $&. Btw, using $& instead of creating capture groups and $1 gives a slight boost to "buk3". Also, I earlier experimented with "yr" - using "pos" (as it is) also gives quite a boost against using $-[0] or $+[0].
      Btw, using $& instead of creating capture groups and $1 gives a slight boost to "buk3". Also, I earlier experimented with "yr" - using "pos" (as it is) also gives quite a boost against using $-[0] or $+[0].

      Interesting. Something for me to experiment with next time I'm doing something similar.

      Also, did you see the results from eily's approach to the problem?


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      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". The enemy of (IT) success is complexity.
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1176317]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-24 07:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found