# The @effects attribute?

**URL:** <https://forums.swift.org/t/the-effects-attribute/13153>\
**Category:** Using Swift\
**Created:** [June 4, 2018, 10:08pm UTC](https://forums.swift.org/t/the-effects-attribute/13153 "2018-06-04T22:08:46Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Jens](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jens/32/12903_2.png) [@Jens](https://forums.swift.org/u/Jens)\
**Post date:** [June 4, 2018, 11:12pm UTC](https://forums.swift.org/t/the-effects-attribute/13153/5 "2018-06-04T23:12:12Z")

</div>

> [@Joe\_Groff](#):
>
> `readnone` , and the other LLVM-level effects, is too low-level of a concept to be generally useful for Swift code.

Yes, my interest was sparked by this post from another thread:

> [@Missed optimization opportunity?](https://forums.swift.org/t/missed-optimization-opportunity/10381/33):
>
> Yeah. `nextUp` is actually slightly more efficient than the C `nextafter` function, because it doesn't need to figure out what direction to move. It's right around the size threshold where inlining would make sense in general contexts. And, yes, we should be able to mark it `readnone` .

And looking at [nextUp's implementation](https://github.com/apple/swift/blob/6585c9239584abff91d4a91d9bf86f2996abb70e/stdlib/public/core/FloatingPointTypes.swift.gyb#L932) as well as eg that of the new hashing, I sometimes [need to write code at that level](https://forums.swift.org/t/is-floats-nextup-really-50-times-slower-than-necessary/9716), so I thought it would be good to know more about `@effects` as part of my ongoing quest to get better at writing performance critical code (both in general and in Swift).

> [@Joe\_Groff](#):
>
> `readnone` means that a function does not read or write memory at all. Unspecialized generic functions pass their arguments through memory so can never be `readnone` .

Does this mean that a generic function can never be marked `@effects(readnone)`, or that it works only together with some other attribute(s) like `@_specialize` or `@_transparent`?

---

_[View the full topic](https://forums.swift.org/t/the-effects-attribute/13153)._
