lua-users home
lua-l archive

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


Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:

>> What sort of performance gains did you see from switching to the BCA
>> format, and which CPUs specifically had this issue, by the way?
> 
> I think currently few CPUs have this issue, and probably I do not have
> access to any of them anyway, so I did not bother to measure. But note
> that the change in our case was completely neutral in any other aspect
> (the code is neither more complicated, nor larger, nor anything at
> all). So, with all other things being completely equal, why not to
> choose the option that may give you (even with a very low probability) a
> slight advantage?
> 
> (If I knew I would have to justify the change, I probably would not have
> done it, since just the job of explaining it is enough to offset those
> frail gains :-)
> 
> -- Roberto

LoL Roberto! :)

I have updated my 64-bit opcode layout as follows:

+--------+-------------------------------+-------------------------------+
|  Mode  |         High 32-bits          |          Low 32-bits          |
+--------+-------+-------+----------+----+-----+-------+---------+-------+
|  iABC  |  Ci   |  Bi   |    C     |    B     |  Ai   |    A    |  OP   |
|        |  8b   |  8b   |   11b    |   11b    |  8b   |   10b   |  8b   |
+--------+-------+-------+----------+----------+-------+---------+-------+
| iABCx  |            Cx            |    B     |  Ai   |    A    |  OP   |
| iABsCx |            27b           |   11b    |  8b   |   10b   |  8b   |
+--------+-----+--------------------+----------+-------+---------+-------+
|  iABx  | NA  |               Bx              |  Ai   |    A    |  OP   |
|        | 6b  |               32b             |  8b   |   10b   |  8b   |
+--------+-----+-------------------------------+-------+---------+-------+

Interestingly, the really super simple benchmark I have been running while
testing my Index type consistently speed up about 0.015 seconds! ;)

However, your point is valid, why not go with the option that may give an
advantage instead of not, especially if there is no actual cost involved.

Thank you again for your feedback, Roberto, it is very appreciated! :)

~Paige