Well basically there is a working version in javascript in c++ one would require that the search string double different null-terminated string or
basically one requires 2 resolution values to be reserved for the special meaning of null or end of data, where the correct ones could be used to terminate
data such one could get a slight performance increase in these cases.
Typically, don't' have to compute the end range and neither have to check it each match on for characters that don't match and if there are a lot of partial matches, then you are winning,
as partial matches are only one character.
But clearly one can't do this optimization any further without some tricks like above and that those values typically have reserved usage, otherwise things break, which means like the cleansing of external data would be required for the
last value to ensure its escape.
So I guess ultimately one would like to be able to range check a statement in parallel, to avoid an encoding schema problem, masync or mparrel{ if(str[k] == strJohn[i] & k < maxK)..}
So I guess just the bitmapPtr and ability to use continue and break skip with labels and maybe this. Will have to get into the arm spesification.
https://es.discourse.group/t/achive-higher-performent-solutions-with-greater-high-level-control-of-break-num-label-continue-skip-equivalent-of-low-level-goto-with-block-chain-of-statments/619/6
Cleansing:
function johnMary(str, strJohn) {
str +="\0"; // add a sentinal, as john out of bounds is undefined, which is not equal to John.
// If the string was really long, this this would have a performance increase and deal with john being able to have null terminate in it.
// Else
// One requires a different double null terminator, so one require 2 resolution value of the string to be searched and one for the smaller string.
let i = strJohn.length -1;
do {
if (strJohn[i] !=='\0') {
str += strJohn.substring(i+1);
break;
}
i--;
} while(i >= 0)
let countJohn = 0;
main:for(let i = 0; i < str.length; i++) {
for (let j = 0, k = i; true; j++, k++) {
if (str[k] !== strJohn[j]){
if (strJohn[j] === undefined) {
countJohn++;
}
continue main;
}
}
}
return countJohn
}
let s = "John\0John\0";
console.log(johnMary(s, "John\0"));
---
function match(char* str) {
char* matchme = "matchme\0";
let countMatch = 0;
for(char* ch = str, char chd = ch*;chd != '\0';ch++, chd = *ch)
{
// could make this an inline function.
char* chs = str, char chds = chs*;
char* mech = matchme, char mechd = *mech ;
while(true) { // sure that by now compiler optermized, could just say loop
if (chds != mechd) {
if(mechd == '\0') {
break;
continue; // kicks out of the loop and skip the rest of the parent look code, for a case that fail, in the case of successfully match, then countMatch++ will execute.
}
}
mech++; mechd = * mech; chs++; chds = *chs ;
}
countMatch++;
}
}