diff options
| author | Eric Wong <e@80x24.org> | 2026-05-21 15:11:10 +0200 |
|---|---|---|
| committer | Christian Hesse <mail@eworm.de> | 2026-05-21 15:27:06 +0200 |
| commit | 1cd637cd1f637aa8aa1c2d416ae01ee31b3a691c (patch) | |
| tree | 9bc05f83725550700bfb47a35502f14172de80ea /cgit.c | |
| parent | 0f782947ed10ba7341d95fcf3de5095c3dc2ef8c (diff) | |
| download | cgit-1cd637cd1f637aa8aa1c2d416ae01ee31b3a691c.tar.gz cgit-1cd637cd1f637aa8aa1c2d416ae01ee31b3a691c.tar.bz2 cgit-1cd637cd1f637aa8aa1c2d416ae01ee31b3a691c.zip | |
use buffered stdio
Our generation of HTML triggers many small write(2) syscalls
which is inefficient.
Time output on a horrible query against my git.git mirror
shows significant performance improvement:
QUERY_STRING='id=2b93bfac0f5bcabbf60f174f4e7bfa9e318e64d5&id2=d6da71a9d16b8cf27f9d8f90692d3625c849cbc8'
PATH_INFO=/mirrors/git.git/diff
export QUERY_STRING PATH_INFO
time ./cgit >/dev/null
Before:
real 0m1.585s
user 0m0.904s
sys 0m0.658s
After:
real 0m0.750s
user 0m0.666s
sys 0m0.076s
Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Diffstat (limited to 'cgit.c')
| -rw-r--r-- | cgit.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -684,7 +684,7 @@ static inline void authenticate_post(void) len = MAX_AUTHENTICATION_POST_BYTES; if ((len = read(STDIN_FILENO, buffer, len)) < 0) die_errno("Could not read POST from stdin"); - if (write(STDOUT_FILENO, buffer, len) < 0) + if (fwrite(buffer, 1, len, stdout) < len) die_errno("Could not write POST to stdout"); cgit_close_filter(ctx.cfg.auth_filter); exit(0); |
