# Performance overhead of an indirection to basic array function

**URL:** https://discourse.julialang.org/t/performance-overhead-of-an-indirection-to-basic-array-function/137663
**Category:** Performance
**Tags:** arrays
**Created:** [June 16, 2026, 11:38pm UTC](https://discourse.julialang.org/t/performance-overhead-of-an-indirection-to-basic-array-function/137663 "2026-06-16T23:38:19Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Tortar](https://avatars.discourse-cdn.com/v4/letter/t/6bbea6/32.png) [@Tortar](https://discourse.julialang.org/u/Tortar)
#### Post date: [June 16, 2026, 11:38pm UTC](https://discourse.julialang.org/t/performance-overhead-of-an-indirection-to-basic-array-function/137663/1 "2026-06-16T23:38:19Z")

</div>

I have a macro which creates these function indirections for very basic collection functions, i.e. it substitutes all `Base.getindex` instances with `_unchecked_getindex`:

```julia-auto
Base.@propagate_inbounds @inline function _unchecked_getindex(collection, indices...)
    return Base.getindex(collection, indices...)
end

Base.@propagate_inbounds @inline function _unchecked_setindex!(collection, value, indices...)
    return Base.setindex!(collection, value, indices...)
end

@inline function _unchecked_in(item, collection)
    return Base.in(item, collection)
end

```

I wonder if, with this, if everything is inferred correctly, the same code should be generated as if I used the `Base` functions themselves, I think it should, but I wonder if there are some footguns in doing something like this.
