lua-users home
lua-l archive

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



A furiously fast (but still pleasant on the eyes :) serialization function would indeed be handy. The multicore performance seems to be largely dependent on serialization speed.

Of course, this only applies if tables are used for passing things over. But -then again- Lua is all about tables, so they should be efficiently and transparently usable in multicore applications, too.

What Say Lua Authors on this?

-asko


Philippe Lhoste kirjoitti 15.3.2007 kello 14:14:

Sam Roberts wrote:
Lua is scheme-minimalist in many ways, but one thing the lisps have
usually provided (always?) is data marshalling. You can write and
read recursive data structures natively. I know, there are dozens of
implementations of this out there for lua... but maybe thats a bad
thing.

That's funny, I just updated my DumpObject script, to sport a nicer (more compact) representation of empty table. I also corrected a bug (non-matching quotes in tostring output for functions and other special data).

http://lua-users.org/wiki/PhilippeLhoste

Not that anybody care, but hey! :-D

I had to write a small function to test if a table is empty. Did I miss something more straightforward? I recall some discussions around this point, but not the final word on the topic...

  function IsTableEmpty(t)
    local c = 0
    for k, v in pairs(t) do c = c + 1 end
    return c == 0
  end

My script is still in Lua 5.0 (works fine in Lua 5.1 too).

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --