diff options
author | Eric Wong | 2019-01-01 13:03:08 +0000 |
---|---|---|
committer | June McEnroe | 2022-02-13 11:55:52 -0500 |
commit | a8e11db6570261d2a3d7d9396b796b72998b7ec5 (patch) | |
tree | f8f37dcb98ef6f5eb6976223c06c9b59aeed329f /ui-snapshot.c | |
parent | Remove redundant title on repo anchors (diff) | |
download | cgit-a8e11db6570261d2a3d7d9396b796b72998b7ec5.tar.gz cgit-a8e11db6570261d2a3d7d9396b796b72998b7ec5.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
Diffstat (limited to 'ui-snapshot.c')
-rw-r--r-- | ui-snapshot.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ui-snapshot.c b/ui-snapshot.c index 556d3ed..8b81e37 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c | |||
@@ -37,6 +37,9 @@ static int write_archive_type(const char *format, const char *hex, const char *p | |||
37 | /* argv_array guarantees a trailing NULL entry. */ | 37 | /* argv_array guarantees a trailing NULL entry. */ |
38 | memcpy(nargv, argv.argv, sizeof(char *) * (argv.argc + 1)); | 38 | memcpy(nargv, argv.argv, sizeof(char *) * (argv.argc + 1)); |
39 | 39 | ||
40 | if (fflush(stdout)) | ||
41 | return errno; | ||
42 | |||
40 | result = write_archive(argv.argc, nargv, NULL, the_repository, NULL, 0); | 43 | result = write_archive(argv.argc, nargv, NULL, the_repository, NULL, 0); |
41 | argv_array_clear(&argv); | 44 | argv_array_clear(&argv); |
42 | free(nargv); | 45 | free(nargv); |