Forever-Young / mrab-regex-hg

Automatically exported from code.google.com/p/mrab-regex-hg
0 stars 0 forks source link

bring 'switch(state->charsize)' out of loops. #99

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Why do you want this feature? What is your use-case?
state->charsize is const during matching,
and all "switch" are in loops(backtrack, advance), 
since these functions have heavily duplicate code.
it should be bring out of loops not only for performance but also for 
maintenance.

What should the syntax or call look like?
-

Do any other regex implementations have something like this?
-

Please provide any additional information below.
-

Original issue reported on code.google.com by Lyricconch on 25 Oct 2013 at 4:50

GoogleCodeExporter commented 9 years ago
I'm not sure what you mean. I try not to duplicate code unless there's a 
measurable benefit in terms of speed, which only really occurs in a tight loop, 
e.g. in 'match_many_ANY'.

Original comment by re...@mrabarnett.plus.com on 25 Oct 2013 at 5:31

GoogleCodeExporter commented 9 years ago
i am reading _regex.c,

duplicate code of "switch (state->charsize)" and "_REV/_IGN" is really ugly ...
modern compiler can optimize function with const parameter correctly, 
i think it's ok to make them together.

Original comment by Lyricconch on 26 Oct 2013 at 2:04