[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Feedback on (awesome) performance of lua 5.4 (work1)
- From: Dibyendu Majumdar <mobile@...>
- Date: Sat, 17 Mar 2018 17:07:45 +0000
On 17 March 2018 at 14:53, Rodrigo Azevedo <rodrigoams@gmail.com> wrote:
> This message is an update about the performance of the following code below,
> designed to be a minimum benchmark of some Lua-ish features that also
> performs an ordinary real-world convolution operation.
>
> ################# BEGIN #################
> -- teste_gc.lua
> --collectgarbage("incremental")
> --collectgarbage("generational")
> N = 2.0e7
>
> C = {}
> for i=1,N do C[i] = i end
>
> local max,min = math.max, math.min
> local conv = function(u,v)
> local m,n = #u,#v
> local w = {}
> for k=1,m+n-1,1 do
> local sum = 0.0
> for j = max(1,k+1-n),min(k,m) do sum = sum + u[j]*v[k-j+1] end
> w[k] = sum
> end
> return table.unpack(w)
> end
>
I recommend also testing this without the max(), min() function calls
inside the loop; as this may skew results due to large overhead in
function calls. Make these inline and see what difference you get
between the various versions.