Patchwork [12,of,13] largefiles: use filechunkiter for iterating largefile when serving getlfile

login
register
mail settings
Submitter Mads Kiilerich
Date April 16, 2013, 2:43 a.m.
Message ID <ec0eedc2dd147693b0e7.1366080209@mk-desktop>
Download mbox | patch
Permalink /patch/1340/
State Accepted
Commit 07e40d589b6478934bd819e5aca95ba589b1db6a
Headers show

Comments

Mads Kiilerich - April 16, 2013, 2:43 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1366065621 -7200
#      Tue Apr 16 00:40:21 2013 +0200
# Node ID ec0eedc2dd147693b0e7f1560dfaa46ded744761
# Parent  376ec3c2b2ae87d1328fa2541b7ecf3acf6bbaf9
largefiles: use filechunkiter for iterating largefile when serving getlfile

The default file iterator is line based and will give odd chunk sizes - often
very short and relatively expensive.

Patch

diff --git a/hgext/largefiles/proto.py b/hgext/largefiles/proto.py
--- a/hgext/largefiles/proto.py
+++ b/hgext/largefiles/proto.py
@@ -63,7 +63,7 @@ 
     # ssh proto does for string responses.
     def generator():
         yield '%d\n' % length
-        for chunk in f:
+        for chunk in util.filechunkiter(f):
             yield chunk
     return wireproto.streamres(generator())