You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// would this be faster?:// https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string-search_algorithmleti=0;while(i<(65536-39)){// every pattern-char is unique,// so we can skip multiple offsets/* c */if(bytes[i+0]!==0x63){i+=1;continue;}/* h */if(bytes[i+1]!==0x68){i+=1;continue;}/* a */if(bytes[i+2]!==0x61){i+=2;continue;}/* r */if(bytes[i+3]!==0x72){i+=3;continue;}/* s */if(bytes[i+4]!==0x73){i+=4;continue;}/* e */if(bytes[i+5]!==0x65){i+=5;continue;}/* t */if(bytes[i+6]!==0x74){i+=6;continue;}break;}if(i>=(65536-40)){return;}
I haven't tested if it has bugs. If anyone from the community wants to test and benchmark it, please do, the maintainers have limited time
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I know I should do benchmarks, but my suggestion really seems to be fast.
Original code:
https://github.com/gorhill/uBlock/blob/8629f07138749e7c6088fbfda84a381f2cd3bc66/src/js/traffic.js#L748-L760
My suggestion (warning: diff link will break):
I haven't tested if it has bugs. If anyone from the community wants to test and benchmark it, please do, the maintainers have limited time
Beta Was this translation helpful? Give feedback.
All reactions