From 09bbda15b26b806c3d63ec5fa4a1f3431c18d96d Mon Sep 17 00:00:00 2001 From: Thomas Nguyen Date: Fri, 19 May 2017 13:17:07 +0800 Subject: Bug 1361699 - Add buffer when writing hashstore to file. r=gcp, r=mcmanus, a=RyanVM We write a lot of 4-bytes prefixes to file which call many system calls. We should use a buffer and only write to file if the buffer is full or finish writing. nsIBufferedOutputStream is a good candidate to do that MozReview-Commit-ID: CzGOd7iXVTv --HG-- extra : source : 8f2b4efc5f0d3191a7e80d9324933621e111b44a --- toolkit/components/url-classifier/HashStore.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'toolkit/components/url-classifier/HashStore.cpp') diff --git a/toolkit/components/url-classifier/HashStore.cpp b/toolkit/components/url-classifier/HashStore.cpp index c298612aa..77bf3cbd4 100644 --- a/toolkit/components/url-classifier/HashStore.cpp +++ b/toolkit/components/url-classifier/HashStore.cpp @@ -964,8 +964,7 @@ HashStore::WriteFile() NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr out; - rv = NS_NewCheckSummedOutputStream(getter_AddRefs(out), storeFile, - PR_WRONLY | PR_TRUNCATE | PR_CREATE_FILE); + rv = NS_NewCheckSummedOutputStream(getter_AddRefs(out), storeFile); NS_ENSURE_SUCCESS(rv, rv); uint32_t written; -- cgit v1.2.3