lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I modify the lua test code and do nothing with lua5.3.4 source code, then setobj become faster.
`
collectgarbage("stop")
local function foo()
     local a = 3
     local b = 4
     for i = 1, 64 * 1024 * 1024 do
         a = b
     end
     print(a)
end
foo()
`
Most likely, the key point is cache.  But no answer in <<64-ia-32-architectures-optimization-manual.>>。

Andrew Gierth <andrew@tao11.riddles.org.uk> 于2019年6月15日周六 上午8:01写道:
>>>>> ">" == 重归混沌  <findstrx@gmail.com> writes:

 >> By the way, can you tell me what's the `performance monitors` you
 >> used.

I don't know what tools are available on linux; what I used (on FreeBSD)
was the hwpmc driver and pmcstat, which gets information from the
hardware performance counters in the CPU. The precise set of events that
can be monitored depends a lot on the CPU you're using, but can be quite
extensive.

Another oddity I'm seeing is that the old setobj is giving me timings
that can vary by over 20% based on the length of the command line and
environment - literally adding a few blank spaces can affect it. I'm
guessing this is some caching effect - aliasing between somewhere in the
stack and something else, I suppose. Still looking into that one as time
permits.

--
Andrew.