Project

General

Profile

Actions

Bug #7006

open

spm: boyermoore implementation appears to underperforming

Added by Victor Julien 8 months ago. Updated 8 months ago.

Status:
New
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

Doing some experiments with benchmarking content inspection. To establish a baseline, first did some "raw" SPM scans. Our SPM_BM appears to dramatically underperform vs Hyperscan, but also against a simple strstr check for the same data+patterns:

 0000  61 62 63 64 65 66 67 68  69 6A 6B 78 78 78 78 78   abcdefgh ijkxxxxx
 0010  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0020  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0030  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0040  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0050  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0060  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0070  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0080  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0090  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 00A0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 00B0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 00C0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 00D0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 00E0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 00F0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0100  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0110  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0120  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0130  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0140  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0150  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0160  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0170  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0180  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0190  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 01A0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 01B0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 01C0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 01D0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 01E0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 01F0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0200  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0210  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0220  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0230  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0240  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0250  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0260  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0270  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0280  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0290  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 02A0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 02B0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 02C0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 02D0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 02E0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 02F0  78 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78   xxxxxxxx xxxxxxxx
 0300  78 78 78 78 78 78 78 78  78 78 78 78 78 6C 6D 6E   xxxxxxxx xxxxxlmn
 0310  6F 70 71 72 73 74 75 76  77 78 79 7A               opqrstuv wxyz
SPM baseline (spm strstr):
Pattern: abc                 : bytes/s: 115362318000, PPS 144927000, Gbps: 880144.625, MiB/s: 110018
Pattern: abcdef              : bytes/s:  54896551000, PPS 68965000, Gbps: 418827.438, MiB/s: 52353
Pattern: xyz                 : bytes/s:   1997991000, PPS  2510000, Gbps: 15243.469, MiB/s:  1905
Pattern: uvwxyz              : bytes/s:  47100591000, PPS 59171000, Gbps: 359349.000, MiB/s: 44918
Pattern: abcdefxyz           : bytes/s:   7282708000, PPS  9149000, Gbps: 55562.652, MiB/s:  6945

SPM baseline (spm bm):
Pattern: abc                 : bytes/s:  53066666000, PPS 66666000, Gbps: 404866.531, MiB/s: 50608
Pattern: abcdef              : bytes/s:  38829268000, PPS 48780000, Gbps: 296243.812, MiB/s: 37030
Pattern: xyz                 : bytes/s:    299450000, PPS   376000, Gbps: 2284.628, MiB/s:   285
Pattern: uvwxyz              : bytes/s:    301881000, PPS   379000, Gbps: 2303.170, MiB/s:   287
Pattern: abcdefxyz           : bytes/s:    297859000, PPS   374000, Gbps: 2272.489, MiB/s:   284

SPM baseline (spm hs):
Pattern: abc                 : bytes/s:  18952380000, PPS 23809000, Gbps: 144595.188, MiB/s: 18074
Pattern: abcdef              : bytes/s:  18383371000, PPS 23094000, Gbps: 140254.000, MiB/s: 17531
Pattern: xyz                 : bytes/s:  12115677000, PPS 15220000, Gbps: 92435.281, MiB/s: 11554
Pattern: uvwxyz              : bytes/s:   9742962000, PPS 12239000, Gbps: 74332.898, MiB/s:  9291
Pattern: abcdefxyz           : bytes/s:  12880258000, PPS 16181000, Gbps: 98268.578, MiB/s: 12283

The 3 last patterns scan the entire buffer, as the patterns are either the buffer's end, or not present. It appears that in this scenario the code isn't performing.

Actions #1

Updated by Victor Julien 8 months ago

  • Description updated (diff)
Actions

Also available in: Atom PDF