in reply to How to find out, why my perl code is slow.

I'm not sure whether I understand your description correctly. Could you include a (hexdump of) short data sample? Using unpack or pack should be faster and more suitable for the task, but I don't have enough will to decipher your code and blindly post my guess.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: How to find out, why my perl code is slow.
by Anonymous Monk on Nov 04, 2018 at 21:26 UTC
    Please find 3 example datasets: (set 1 starts with 0x31, set 2 starts with 0x32, ser3 with 0x33)
    $f=(0x31, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0x58, 0x17, 0x30, +0x06, 0x18, 0x26, 0x25, 0x27, 0x26, 0x21, 0x23, 0x21, 0x6E, 0x5D, 0x5 +3, 0x46, 0x17, 0x2D, 0x62, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x26, 0x2F, 0x2D, 0x2D, 0x2D, 0x2E, 0x2D, 0x0 +0, 0x00, 0x80, 0x00, 0x00, 0x01, 0x50, 0x59, 0x12, 0x00, 0xA8, 0x32, +0xC0, 0x01, 0xD0, 0x26, 0x25, 0x22, 0x22, 0x89, 0x33, 0x60, 0x80, 0x8 +0, 0x26, 0x18, 0x7C, 0x34, 0xFF);
      Sorry 1 was too fast. The 0x34 at the end should not be there ! (start of new dataset !) Correct is:
      $f=(0x31, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0x58, 0x17, 0x30, +0x06, 0x18, 0x26, 0x25, 0x27, 0x26, 0x21, 0x23, 0x21, 0x6E, 0x5D, 0x5 +3, 0x46, 0x17, 0x2D, 0x62, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x26, 0x2F, 0x2D, 0x2D, 0x2D, 0x2E, 0x2D, 0x0 +0, 0x00, 0x80, 0x00, 0x00, 0x01, 0x50, 0x59, 0x12, 0x00, 0xA8, 0x32, +0xC0, 0x01, 0xD0, 0x26, 0x25, 0x22, 0x22, 0x89, 0x33, 0x60, 0x80, 0x8 +0, 0x26, 0x18, 0x7C, 0xFF);

        $f is a scalar, not an array, so that should be:

        $f = "\x31\xFC\xFF\xFF\xFF\xFF\xFF\xFE\x58\x17\x30\x06\x18\x26\x25\x27 +\x26\x21\x23\x21\x6E\x5D\x53\x46\x17\x2D\x62\x00\x00\xC0\x00\x00\x00\ +x00\x00\x00\x00\x00\x26\x2F\x2D\x2D\x2D\x2E\x2D\x00\x00\x80\x00\x00\x +01\x50\x59\x12\x00\xA8\x32\xC0\x01\xD0\x26\x25\x22\x22\x89\x33\x60\x8 +0\x80\x26\x18\x7C\xFF";