# Is @evalpoly needed anymore?

**URL:** <https://discourse.julialang.org/t/is-evalpoly-needed-anymore/86732>\
**Category:** Performance\
**Created:** [September 3, 2022, 3:42pm UTC](https://discourse.julialang.org/t/is-evalpoly-needed-anymore/86732 "2022-09-03T15:42:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shmiggles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shmiggles/32/19871_2.png) [@shmiggles](https://discourse.julialang.org/u/shmiggles)\
**Post date:** [September 3, 2022, 3:42pm UTC](https://discourse.julialang.org/t/is-evalpoly-needed-anymore/86732/1 "2022-09-03T15:42:55Z")

</div>

Julia provides two ways of polynomial evaluation: one as a function (`evalpoly`) and the other as a macro (`@evalpoly`). My understanding is that the macro can (sometimes) be faster than the function due to inlining. However, Julia 1.8 now supports `@inline` at the call-site now. So would `@inline evalpoly(...)` have the same performance characteristics as `@evalpoly(...)`.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 3, 2022, 4:14pm UTC](https://discourse.julialang.org/t/is-evalpoly-needed-anymore/86732/2 "2022-09-03T16:14:45Z")

</div>

The macro is mainly there for backwards compatibility as far as I know. The function form is supposed to be just as fast as long as you pass a tuple of coefficients. But there were some cases where it caused a slowdown due to a failure to inline; that might be improved by `@inline`?

See the discussion in [Add evalpoly function by MasonProtter · Pull Request #32753 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/32753) and the inlining issue discussed [here](https://github.com/JuliaLang/julia/pull/32753#issuecomment-667798570).

(Probably the documentation for `@evalpoly` should be updated.)
