that CPU usage of charset body filter has decreased from 7.5% to 5.5%
if gzipping is disabled
static ngx_uint_t
ngx_http_charset_recode(ngx_buf_t *b, u_char *table)
{
- u_char *p;
+ u_char *p, *last;
- for (p = b->pos; p < b->last; p++) {
+ last = b->last;
- if (*p == table[*p]) {
- continue;
+ for (p = b->pos; p < last; p++) {
+
+ if (*p != table[*p]) {
+ goto recode;
}
+ }
+
+ return 0;
- while (p < b->last) {
+recode:
+
+ do {
+ if (*p != table[*p]) {
*p = table[*p];
- p++;
}
- b->in_file = 0;
+ p++;
- return 1;
- }
+ } while (p < last);
- return 0;
+ b->in_file = 0;
+
+ return 1;
}