There might have been this discussion many years ago already...
Anyway, while examining performance issues with mod feed on my server i found that the culprit is
xmlify()
which does not perform very well at its current state.
It does this on every string:
$len = mb_strlen($str);
for($x = 0; $x < $len; $x ++) {
$char = mb_substr($str,$x,1);
switch( $char ) {
case "\r" :
break;
case "&" :
$buffer .= '&';
break;
case "'" :
$buffer .= ''';
break;
case "\"" :
$buffer .= '"';
break;
case '<' :
$buffer .= '<';
break;
case '>' :
$buffer .= '>';
break;
case "\n" :
$buffer .= "\n";
break;
default :
$buffer .= $char;
break;
}
}
Using
htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
is much faster (and it does not time out at my server). I am not sure though if it is sufficient.
Has anyone got a better idea?
!!
zotlabs.org | Hubzilla Development