[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Question about Lua 5.1.3 and realloc() on life.lua
- From: "Bogdan Marinescu" <bogdan.marinescu@...>
- Date: Fri, 2 May 2008 00:02:44 +0300
So that was it. It makes sense now, thank you. Still I wonder if a
strategy to realloc a minimum delta of memory (say 16 bytes) wouldn't
prevent situations like this without having much impact on the overall
memory consumption. I think I'll test this and see where it goes.
On Thu, May 1, 2008 at 11:52 PM, Mike Pall <mikelu-0805@mike.de> wrote:
> Bogdan Marinescu wrote:
> > I ran 'life.lua', and the results surprised me. Specifically, I can see lots
> > and lots of realloc calls with a one byte difference between the old block
> > size and the new block size, in both directions (+1 or -1 difference).
>
> This particular program spends most of its time doing char-by-char
> string concatenation in a tight loop. This is not a recommended
> practice and hopefully not representative for professionally
> written Lua programs.
>
> Most of the stuff in the test directory should be ignored. It
> exhibits bad programming practice (e.g. no locals), people have
> been abusing these for benchmarking Lua and despite the directory
> name it's not a test suite at all. It gives newcomers a bad first
> impression of Lua. This was discussed two years ago, but nothing
> happened.
>
> --Mike
>