Changeset 519
- Timestamp:
- 12/13/06 21:11:47 (2 years ago)
- Files:
-
- cherokee/branches/0.5/ChangeLog (modified) (1 diff)
- cherokee/branches/0.5/cherokee/buffer.c (modified) (8 diffs)
- cherokee/branches/0.5/cherokee/handler_error.c (modified) (2 diffs)
- cherokee/branches/0.5/cherokee/handler_file.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/branches/0.5/ChangeLog
r515 r519 1 2006-12-12 A.D.F <adefacc@tin.it> 2 3 * cherokee/buffer.c: 4 - fixes to cherokee_buffer_ensure_size(); 5 - add 1 to a few cherokee_buffer_ensure_size() calls, 6 in order to always reserve space 7 for buffer / string terminator '\0'. 8 9 * cherokee/handler_file.c: 10 - add a cherokee_buffer_ensure_size(buffer, 288) 11 to cherokee_handler_file_add_headers(), 12 in order to avoid too many reallocations 13 (now none for 99.99% of responses); 14 15 this modification speed up Cherokee by over 1.5% 16 when serving small files ( < 2KB) 17 with 200 or 304 responses. 18 19 * cherokee/handler_error.c: 20 - add two calls to cherokee_buffer_ensure_size() 21 in order to avoid too many reallocations; 22 23 this modification speed up Cherokee by over 4% 24 when answering with 404 error message 25 (3020 -> 3150 responses / sec.). 26 1 27 2006-12-11 A.D.F <adefacc@tin.it> 2 28 cherokee/branches/0.5/cherokee/buffer.c
r402 r519 293 293 /* Maybe it doesn't need it 294 294 */ 295 if (size < buf->len)295 if (size <= (size_t) buf->size) 296 296 return ret_ok; 297 297 … … 300 300 if (buf->buf == NULL) { 301 301 buf->buf = (char *) malloc (size); 302 if (unlikely (buf->buf == NULL)) return ret_nomem; 302 if (unlikely (buf->buf == NULL)) 303 return ret_nomem; 303 304 buf->size = size; 304 305 return ret_ok; … … 308 309 */ 309 310 buf->buf = (char *) realloc(buf->buf, size); 310 if (unlikely (buf->buf == NULL)) return ret_nomem; 311 if (unlikely (buf->buf == NULL)) 312 return ret_nomem; 311 313 buf->size = size; 312 314 … … 555 557 556 558 initial_size = buf->len; 557 cherokee_buffer_ensure_size (buf, buf->len * num );559 cherokee_buffer_ensure_size (buf, buf->len * num + 1); 558 560 559 561 for (i=0; i<num; i++) { … … 628 630 switch (ver) { 629 631 case ver_full_html: 630 cherokee_buffer_ensure_size (buf, buf->len + 29 + sizeof(PACKAGE_VERSION) + 6 + port_len + 10 );632 cherokee_buffer_ensure_size (buf, buf->len + 29 + sizeof(PACKAGE_VERSION) + 6 + port_len + 10 + 1); 631 633 632 634 cherokee_buffer_add_str (buf, … … 637 639 638 640 case ver_port_html: 639 cherokee_buffer_ensure_size (buf, buf->len + 34 + port_len + 10 );641 cherokee_buffer_ensure_size (buf, buf->len + 34 + port_len + 10 + 1); 640 642 641 643 cherokee_buffer_add_str (buf, "<address>Cherokee web server Port "); … … 752 754 /* Get memory 753 755 */ 754 ret = cherokee_buffer_ensure_size (&new_buf, (buf->len+4)*4/3 );756 ret = cherokee_buffer_ensure_size (&new_buf, (buf->len+4)*4/3 + 1); 755 757 if (unlikely (ret != ret_ok)) return ret; 756 758 … … 947 949 cherokee_buffer_t encoded = CHEROKEE_BUF_INIT; 948 950 949 cherokee_buffer_ensure_size (&encoded, (SHA1_DIGEST_SIZE * 2) + 1);951 cherokee_buffer_ensure_size (&encoded, (SHA1_DIGEST_SIZE * 2) + 1); 950 952 951 953 cherokee_buffer_encode_sha1 (buf, &encoded); cherokee/branches/0.5/cherokee/handler_error.c
r451 r519 73 73 cuint_t port; 74 74 cherokee_buffer_t *escaped = NULL; 75 76 /* Ensure minimum size to avoid too many reallocations. 77 */ 78 cherokee_buffer_ensure_size(buffer, 768); 75 79 76 80 cherokee_buffer_add_str (buffer, "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">" CRLF); … … 195 199 { 196 200 cherokee_connection_t *conn = HANDLER_CONN(hdl); 201 202 /* Ensure minimum size to avoid too many reallocations. 203 */ 204 cherokee_buffer_ensure_size(buffer, 384); 197 205 198 206 /* It has special headers on protocol upgrading cherokee/branches/0.5/cherokee/handler_file.c
r422 r519 507 507 cherokee_connection_t *conn = HANDLER_CONN(fhdl); 508 508 509 /* Ensure minimum buffer size to avoid or 510 * at least reduce the number of reallocations. 511 */ 512 cherokee_buffer_ensure_size(buffer, 288); 513 509 514 /* Etag 510 515 */