Re: Huge performance loss when processing lots of data

  • From: Chris <chris@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Tue, 03 Jul 2012 14:58:08 -0400

On 07/03/2012 02:45 PM, Mike Pall wrote:
Well, what's the point in creating different struct types with
identical contents? Because you want different metatypes, but why?

Types are not the proper mechanism for this. Dispatch from a
single set of metamethods instead.

And you realize that "return d[i]" refers to the upvalue 'd' and
not to o.d? I don't think that's what you want.

Yes. I'm keeping all this data in RAM and I need a custom metatable for each data block because each one has a unique set of functionality (like I said, there is actually a lot more code to this; I actually implement a bunch of metamethods). Previously I found using upvalues was significantly faster when emulating an array and since I was creating a custom type anyway I just use the upvalue.

Obviously there are other ways to do this but I can't see any other way that will give me the same performance.

Every different type spawns a new trace that's attached to the
previous trace. There's a limit to this and after that you end up
in the interpreter.

Got it, thanks.


Other related posts: