couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rand...@apache.org
Subject svn commit: r1169587 - /couchdb/trunk/src/couchdb/couch_os_process.erl
Date Mon, 12 Sep 2011 00:05:47 GMT
Author: randall
Date: Mon Sep 12 00:05:46 2011
New Revision: 1169587

URL: http://svn.apache.org/viewvc?rev=1169587&view=rev
Log:
minor optimization for binary query server i/o

Rather than constructing and reversing an iolist with list append
operations, use cheap refc binary appends.

Modified:
    couchdb/trunk/src/couchdb/couch_os_process.erl

Modified: couchdb/trunk/src/couchdb/couch_os_process.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_os_process.erl?rev=1169587&r1=1169586&r2=1169587&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_os_process.erl (original)
+++ couchdb/trunk/src/couchdb/couch_os_process.erl Mon Sep 12 00:05:46 2011
@@ -66,8 +66,16 @@ readline(#os_proc{} = OsProc) ->
     readline(OsProc, []).
 readline(#os_proc{port = Port} = OsProc, Acc) ->
     receive
+    {Port, {data, {noeol, Data}}} when is_binary(Acc) ->
+        readline(OsProc, <<Acc/binary,Data/binary>>);
+    {Port, {data, {noeol, Data}}} when is_binary(Data) ->
+        readline(OsProc, Data);
     {Port, {data, {noeol, Data}}} ->
         readline(OsProc, [Data|Acc]);
+    {Port, {data, {eol, <<Data/binary>>}}} when is_binary(Acc) ->
+        [<<Acc/binary,Data/binary>>];
+    {Port, {data, {eol, Data}}} when is_binary(Data) ->
+        [Data];
     {Port, {data, {eol, Data}}} ->
         lists:reverse(Acc, Data);
     {Port, Err} ->



Mime
View raw message