# Any at UnitRange seems unoptimal

**URL:** <https://discourse.julialang.org/t/any-at-unitrange-seems-unoptimal/88650>\
**Category:** Internals & Design\
**Tags:** unitrange\
**Created:** [October 13, 2022, 9:05am UTC](https://discourse.julialang.org/t/any-at-unitrange-seems-unoptimal/88650 "2022-10-13T09:05:38Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![Marcell\_Havlik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marcell_havlik/32/37424_2.png) [@Marcell\_Havlik](https://discourse.julialang.org/u/Marcell_Havlik)\
**Post date:** [October 13, 2022, 4:17pm UTC](https://discourse.julialang.org/t/any-at-unitrange-seems-unoptimal/88650/21 "2022-10-13T16:17:01Z")

</div>

Thank you!  
`PartialStruct` is understandable for me I think. For me it some kind of “abstract” set that hold infromation for the compiler, that could do some optimization based on the hardcoded values in special cases.

For me, my tactic is like:

- I use Tuples in cases like where I know there will be 2-3-4 element on that position that type would be nice to be compile time optimised in the function I call.
- I use Arrays where they are homogeneous elements.
- In case of heterogeneous sets I think I use Arrays sometime but I try to always split them into multiple arrays if it isn’t too too big effort.

By the way

> [@Sukera](#):
>
> It can for example be very bad for performance when there’s lots of different tuples that need to be handled, as is the case in the compiler.

Isn’t `@nospecialize` would be good for that, so even with Tuple we wouldn’t do any recompilation?

[Previous page](https://discourse.julialang.org/t/any-at-unitrange-seems-unoptimal/88650.md?page=1)
