# Understanding when @inlinable is needed for generic specialization

**URL:** <https://forums.swift.org/t/understanding-when-inlinable-is-needed-for-generic-specialization/61569>\
**Category:** Using Swift\
**Created:** [November 22, 2022, 12:47am UTC](https://forums.swift.org/t/understanding-when-inlinable-is-needed-for-generic-specialization/61569 "2022-11-22T00:47:18Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![hassila](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hassila/32/22647_2.png) [@hassila](https://forums.swift.org/u/hassila)\
**Post date:** [November 23, 2022, 10:20am UTC](https://forums.swift.org/t/understanding-when-inlinable-is-needed-for-generic-specialization/61569/6 "2022-11-23T10:20:24Z")

</div>

> [@lukasa](#):
>
> In principle, you can avoid this by using cross-module optimisation.

But with care, see e.g.

> [@What are the tradeoffs of -cross-module-optimization?](https://forums.swift.org/t/what-are-the-tradeoffs-of-cross-module-optimization/45585/13):
>
> Just a small data point, tried this out on a small sample project and got a 4x reduction in performance (reproducible) with cross-module-optimization enabled on my M1 Max laptop: hassila@max ~/D/G/p/swift-benchmark (main)\> swift run -c release Building for production... Build complete! (0.08s) Start test 1064784 usec hassila@max ~/D/G/p/swift-benchmark (main)\> swift run -Xswiftc -cross-module-optimization -c release Building for production... [4/4] Linking swift-benchmark Build complete! (2.10s…

(I'll admit we haven't tried it again since April, so maybe something was fixed in 5.7)

---

_[View the full topic](https://forums.swift.org/t/understanding-when-inlinable-is-needed-for-generic-specialization/61569)._
