# Type instability in Folds.map

**URL:** <https://discourse.julialang.org/t/type-instability-in-folds-map/84080>\
**Category:** Performance\
**Tags:** folds, map\
**Created:** [July 12, 2022, 3:54am UTC](https://discourse.julialang.org/t/type-instability-in-folds-map/84080 "2022-07-12T03:54:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MattSainsbury-Dale](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattsainsbury-dale/32/221714_2.png) [@MattSainsbury-Dale](https://discourse.julialang.org/u/MattSainsbury-Dale)\
**Post date:** [July 12, 2022, 3:54am UTC](https://discourse.julialang.org/t/type-instability-in-folds-map/84080/1 "2022-07-12T03:54:28Z")

</div>

Hello, I’ve noticed that the `Folds` version of `map()` seems to introduce type instability:

```julia
using Folds
f1(K::Integer) = map(identity, 1:K) 
f2(K::Integer) = Folds.map(identity, 1:K) 

@code_warntype f1(5)
@code_warntype f2(5)

```

Does anyone have any suggestions as to why this is happening and possible remedies?
