# Is the julia compiler smart enough to treat \`x in (y,)\` the same as \`x == y\`?

**URL:** <https://discourse.julialang.org/t/is-the-julia-compiler-smart-enough-to-treat-x-in-y-the-same-as-x-y/82830>\
**Category:** Internals & Design\
**Tags:** question, performance\
**Created:** [June 15, 2022, 7:21pm UTC](https://discourse.julialang.org/t/is-the-julia-compiler-smart-enough-to-treat-x-in-y-the-same-as-x-y/82830 "2022-06-15T19:21:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dylanxyz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylanxyz/32/36646_2.png) [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)\
**Post date:** [June 15, 2022, 7:21pm UTC](https://discourse.julialang.org/t/is-the-julia-compiler-smart-enough-to-treat-x-in-y-the-same-as-x-y/82830/1 "2022-06-15T19:21:49Z")

</div>

I’m just wondering if the julia compiler can treat a expression like `x in (y,)` the same as `x == y`, assuming that the _right_ argument for `in` is always a 1-sized tuple. Moreover, what would be the performance difference between these two pieces of code?

Edit: typo in the title

---

<div class="post-metadata">

**Author:** ![stillyslalom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stillyslalom/32/45687_2.png) [@stillyslalom](https://discourse.julialang.org/u/stillyslalom)\
**Post date:** [June 15, 2022, 7:33pm UTC](https://discourse.julialang.org/t/is-the-julia-compiler-smart-enough-to-treat-x-in-y-the-same-as-x-y/82830/2 "2022-06-15T19:33:25Z")

</div>

Sure looks like it!

```julia
julia> @code_native debuginfo=:none 1 in (1,)

        pushq %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset %rbp, -16
        movq %rsp, %rbp
        .cfi_def_cfa_register %rbp
        cmpq %rcx, (%rdx)
        sete %al
        popq %rbp
        retq

```

```julia
julia> @code_native debuginfo=:none 1 == 1

        pushq %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset %rbp, -16
        movq %rsp, %rbp
        .cfi_def_cfa_register %rbp
        cmpq %rdx, %rcx
        sete %al
        popq %rbp
        retq

```

---

<div class="post-metadata">

**Author:** ![dylanxyz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylanxyz/32/36646_2.png) [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)\
**Post date:** [June 15, 2022, 7:36pm UTC](https://discourse.julialang.org/t/is-the-julia-compiler-smart-enough-to-treat-x-in-y-the-same-as-x-y/82830/3 "2022-06-15T19:36:47Z")

</div>

Oh that’s cool! i guess there’s no performance difference then
