lua-users home
lua-l archive

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


It was also mentioned a couple times that the performance wasn't as good as hoped. It's possible that union is confounding the compiler.

On Wed, Jun 10, 2015 at 7:06 AM, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> I overlay the double with the type code.
>
> So the structure looks like this:
>
> |------ first 8 bytes ----------| |------- second 8 bytes -------|
>   value other than double        type code (int) union
>   including 64-bit int                 with double
>
> Since the size of the value object is 16 bytes anyway it doesn't
> change the overall size.

What do you gain here? The standard representation is this:

  |------ first 8 bytes ----------| |------- second 8 bytes -------|
    any value including double           type code (int)
    and 64-bit int

It occupies the same space and it is simpler...

-- Roberto




--
Brigham Toskin