Improve B2g performance by merging pattern array and hash.

remotes/origin/master-1.0.x
Victor Julien 15 years ago
parent 83b2c8abdb
commit 31261e7583

File diff suppressed because it is too large Load Diff

@ -51,7 +51,7 @@
//#define B2G_SEARCH2 //#define B2G_SEARCH2
//#define B2G_COUNTERS //#define B2G_COUNTERS
#if 0
typedef struct B2gPattern_ { typedef struct B2gPattern_ {
uint8_t flags; /**< MPM_PATTERN_FLAG_* flags */ uint8_t flags; /**< MPM_PATTERN_FLAG_* flags */
uint16_t len; /**< \todo we're limited to 32/64 byte lengths, uint8_t would be fine here */ uint16_t len; /**< \todo we're limited to 32/64 byte lengths, uint8_t would be fine here */
@ -60,12 +60,16 @@ typedef struct B2gPattern_ {
struct B2gPattern_ *next; struct B2gPattern_ *next;
uint32_t id; uint32_t id;
} B2gPattern; } B2gPattern;
#endif
typedef struct B2gHashItem_ { typedef struct B2gPattern_ { //HashItem_ {
uint16_t idx; uint16_t len; /**< \todo we're limited to 32/64 byte lengths, uint8_t would be fine here */
uint8_t flags; uint8_t flags;
struct B2gHashItem_ *nxt; uint8_t pad0;
} B2gHashItem; struct B2gPattern_ *next;
uint8_t *cs; /* case sensitive */
uint8_t *ci; /* case INsensitive */
uint32_t id;
} B2gPattern;//HashItem;
typedef struct B2gCtx_ { typedef struct B2gCtx_ {
B2G_TYPE *B2G; B2G_TYPE *B2G;
@ -84,8 +88,8 @@ typedef struct B2gCtx_ {
uint16_t pat_x_cnt; uint16_t pat_x_cnt;
uint32_t hash_size; uint32_t hash_size;
B2gHashItem **hash; B2gPattern **hash;
B2gHashItem hash1[256]; B2gPattern hash1[256];
#ifdef B2G_SEARCH2 #ifdef B2G_SEARCH2
B2gHashItem **hash2; B2gHashItem **hash2;
#endif #endif

@ -111,6 +111,8 @@ typedef struct MpmCtx_ {
#define MPM_PATTERN_FLAG_DEPTH 0x04 #define MPM_PATTERN_FLAG_DEPTH 0x04
/** pattern has an offset setting */ /** pattern has an offset setting */
#define MPM_PATTERN_FLAG_OFFSET 0x08 #define MPM_PATTERN_FLAG_OFFSET 0x08
/** one byte pattern (used in b2g) */
#define MPM_PATTERN_ONE_BYTE 0x10
typedef struct MpmTableElmt_ { typedef struct MpmTableElmt_ {
char *name; char *name;

Loading…
Cancel
Save