switch to hash-based get_one_special()
PATCH 1/1 switch to hash-based get_one_special()
Subject: [PATCH] switch to hash-based get_one_special()
Weird, but true: the set of C two-character punctuators and two-symbol prefices of three-character punctuators is distinguishable by 5-bit hash function (27 out of 32). Application is obvious - we get much faster get_one_special() out of that...
---
[and now all patches older than a month are gone]
token.h | 18 +++++++------- tokenize.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 75 insertions(+), 21 deletions(-)
token.h +9 -9
@@ -88,13 +88,13 @@ #define COMBINATION_STRINGS { \"*=" , \"/=" , \"%=" , \ -".." ,"..." , \ -"<=" ,"<<" ,"<<=" , \ -">=" ,">>" ,">>=" , \ +"<=" ,">=" , \"==" ,"!=" , \"&&" ,"&=" , \"||" ,"|=" , \"^=" ,"##" , \ +"<<" ,">>" ,".." , \ +"<<=" ,">>=" ,"..." \"" , \"<" ,">" ,"<=" ,">=" \ }
@@ -111,14 +111,8 @@ enum special_token {SPECIAL_MUL_ASSIGN ,SPECIAL_DIV_ASSIGN ,SPECIAL_MOD_ASSIGN , -SPECIAL_DOTDOT , -SPECIAL_ELLIPSIS ,SPECIAL_LTE , -SPECIAL_LEFTSHIFT , -SPECIAL_SHL_ASSIGN ,SPECIAL_GTE , -SPECIAL_RIGHTSHIFT , -SPECIAL_SHR_ASSIGN ,SPECIAL_EQUAL ,SPECIAL_NOTEQUAL , SPECIAL_LOGICAL_AND,
@@ -127,6 +121,12 @@ enum special_token {SPECIAL_OR_ASSIGN ,SPECIAL_XOR_ASSIGN ,SPECIAL_HASHHASH , +SPECIAL_LEFTSHIFT , +SPECIAL_RIGHTSHIFT , +SPECIAL_DOTDOT , +SPECIAL_SHL_ASSIGN , +SPECIAL_SHR_ASSIGN , +SPECIAL_ELLIPSIS ,SPECIAL_ARG_SEPARATOR ,SPECIAL_UNSIGNED_LT , SPECIAL_UNSIGNED_GT,
tokenize.c +66 -12
102 lines not on this page · raw message
Signature · 1 line
1.4.2.GIT
Quoted 6 lines · Al Viro
Weird, but true: the set of C two-character punctuators and two-symbol prefices of three-character punctuators is distinguishable by 5-bit hash function (27 out of 32). Application is obvious - we get much faster
get_one_special()out of that...
Quoted 8 lines
Signed-off-by Al Viro <[email protected]>---
[and now all patches older than a month are gone]
token.h | 18 +++++++------- tokenize.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 75 insertions(+), 21 deletions(-)
Added to my sparse tree at:git://git.kernel.org/pub/scm/linux/kernel/git/josh/sparse.git
Thanks,
Josh Triplett