Faster comparisons

You're right B-D


On Sun, Jun 8, 2014 at 5:04 PM, tizoc <notifications@github.com> wrote:

> In equal.lua:
>
> > @@ -21,26 +21,33 @@
> >  -- THE SOFTWARE.
> >
> >  local function equal(x, y)
> > +	-- Compare by primitive equality first.
> > +	if x == y then return true end
> > +
> > +	-- If a custom __eq has been defined, trust == even
> > +	-- for tables.
> > +	local mtx, mty = getmetatable(x), getmetatable(y)
> > +	if (mtx and mtx.__eq) or (mty and mty.__eq) then return false end
>
> Well, x == y has been tested already, we know it is false, otherwise the
> function would have returned already
> … <#1467df0af25433dd_>
> On Jun 8, 2014 8:48 PM, "Cyril David" <notifications@github.com> wrote:
> In equal.lua: > @@ -21,26 +21,33 @@ > -- THE SOFTWARE. > > local function
> equal(x, y) > + -- Compare by primitive equality first. > + if x == y then
> return true end > + > + -- If a custom __eq has been defined, trust == even
> > + -- for tables. > + local mtx, mty = getmetatable(x), getmetatable(y) >
> + if (mtx and mtx.__eq) or (mty and mty.__eq) then return false end @tizoc
> <https://github.com/tizoc> <https://github.com/tizoc> am I
> misunderstanding or shouldn't we return x == y end instead of return false
> ? — Reply to this email directly or view it on GitHub <
> https://github.com/cyx/equal.lua/pull/1/files#r13527125>.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/cyx/equal.lua/pull/1/files#r13527201>.
>