[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Understanding 'perf report' result lua 5.2.3: __memcpy_sse2_unaligned ?
- From: Hisham <h@...>
- Date: Thu, 11 Dec 2014 13:41:43 -0200
On 9 December 2014 at 13:36, Valerio Schiavoni
> Hello Roberto,
> thanks for your explanation.
> On Tue, Dec 9, 2014 at 3:36 PM, Roberto Ierusalimschy
> <firstname.lastname@example.org> wrote:
>>> What is it happening that triggers that many '__memcpy_sse2_unaligned' ?
>> If I understood the report correctly, there is no indication that there
>> are too many '__memcpy_sse2_unaligned'; it is big only in comparison
>> with the rest. If all your server does is to move data around (e.g.,
>> it reads it from somewhere, creates a Lua string with it, and then writes
>> it somewhere else),
> Well, in my test-case, this is all the server does:
> local data = clientsocket:receive(payload_size)
> As you see, the data is read/received from a (non-blocking) LuaSocket
> and then simply ignored until the end of the function.
> On a 1Gbs-network, this single call to receive takes an average of 5.3
> seconds when the payload_size is big (128MB).
My guess is that you should probably be using LuaSocket's
sources/sinks/filters features (aka "ltn12" module) to perform this
read in a chunk-by-chunk basis instead of making one big 128MB
operation. LuaSocket is probably growing and growing its internal
buffer to make you that big string when in reality you don't ever need
one huge 128MB string in your code.