[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Pooling of strings is good
- From: Coroutines <coroutines@...>
- Date: Mon, 25 Aug 2014 09:35:28 -0700
On Mon, Aug 25, 2014 at 9:22 AM, Philipp Janda <siffiejoe@gmx.net> wrote:
> The string library doesn't make sense for generic userdata, it only makes
> sense for character arrays a.k.a buffers. That's why I suggested you write a
> buffer userdata type. And please don't try to replace the string library
> with your own version. Just take `lstrlib.c`, replace `luaL_checkstring`
> with `luaL_checkudata`, and register those functions as methods of your
> buffer userdata. Yes, you duplicate a lot of code, but you stay backwards
> compatible with current Lua, and you stay type-safe.
Yes, this is what's expected -- I just disagree with the code
duplication a lot :>
> But it would be a shame if your socket library only worked in debug mode,
> wouldn't it?
If I care this much about performance and not stressing allocations, I
think I'd be okay with requiring the debug library be present -- that
said, I haven't worked in a lua env where it hasn't been available.
I've made sandboxes where I've personally removed it, though. I don't
feel like it would be a very distressing dependency.. but you have a
point.
- References:
- Pooling of strings is good, Dirk Laurie
- Re: Pooling of strings is good, Coroutines
- Re: Pooling of strings is good, Dirk Laurie
- Re: Pooling of strings is good, Coroutines
- Re: Pooling of strings is good, Jay Carlson
- Re: Pooling of strings is good, Coroutines
- Re: Pooling of strings is good, Jay Carlson
- Re: Pooling of strings is good, Coroutines
- Re: Pooling of strings is good, Sean Conner
- Re: Pooling of strings is good, Coroutines
- Re: Pooling of strings is good, Philipp Janda
- Re: Pooling of strings is good, Coroutines
- Re: Pooling of strings is good, Philipp Janda