lua-users home
lua-l archive

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


Hey

On 16 March 2017 at 18:45, Viacheslav Usov <via.usov@gmail.com> wrote:
Your numbers could not stop anyone from doing anything blindly, because you did not say what exactly you measured, and how significant 0.01 s was for that. It could have been half the total execution time for all we know.

Even if it was half, a million table inserts taking 0.01 or 0.02 seconds is, in probably the vast majority of cases, completely fine :)

But, for the sake of completeness, on the 4GHz i7 the run time was 0.24s vs 0.23s, on the Pi it was 2.20s vs 2.04s.
 
In a benchmark I just ran, I get ca 10% speed-up by caching table.insert. Not a lot, but, as said by others, could make all the difference.

I'd like to make it clear that I am not saying people shouldn't optimise. If your project has time-critical needs, or high throughput needs, etc. you absolutely should be profiling and optimising all sorts of layers in your stack. I'm just trying to challenge the base assumption that I see in a lot of Lua code, that the caching should be done all the time.

In the general case, I think the harm to developers is worse than the gain in performance :)

--
Cheers,

Chris