# Keyword versus positional arguments

**URL:** <https://discourse.julialang.org/t/keyword-versus-positional-arguments/35538>\
**Category:** Performance\
**Tags:** question\
**Created:** [March 4, 2020, 9:11pm UTC](https://discourse.julialang.org/t/keyword-versus-positional-arguments/35538 "2020-03-04T21:11:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aerdely](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aerdely/32/37506_2.png) [@aerdely](https://discourse.julialang.org/u/aerdely)\
**Post date:** [March 4, 2020, 9:11pm UTC](https://discourse.julialang.org/t/keyword-versus-positional-arguments/35538/1 "2020-03-04T21:11:05Z")

</div>

Reviewing @avik Sengupta’s book «Julia High Performance» 2nd edition, it says that performance of functions with positional arguments is better than those with keyword (named) arguments, giving the following example:

```julia
using BenchmarkTools
named_param(x; y=1, z=1) = x^y + x^z
pos_param(x,y,z) = x^y + x^z
@btime named_param(4; y=2, z=3)
@btime pos_param(4, 2, 3)

```

Sengupta’s book reports `8.306ns` for `named_param` and `5.548ns` for `pos_param`:

![kwargs1](https://global.discourse-cdn.com/julialang/original/3X/b/f/bf65d7bb13b945087b53804627d6671eacacf08d.png)

but running the same code in my own computer I get the opposite:

 ![kwargs2](https://global.discourse-cdn.com/julialang/original/3X/a/2/a2ebb66b942fc5495d406b230324da4e3ae65273.png)

Any explanation for this?

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [March 4, 2020, 9:14pm UTC](https://discourse.julialang.org/t/keyword-versus-positional-arguments/35538/2 "2020-03-04T21:14:03Z")

</div>

That advise was correct until 1.0 (technically 0.7), but is thankfully no longer true.

---

<div class="post-metadata">

**Author:** ![avik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/avik/32/17_2.png) [@avik](https://discourse.julialang.org/u/avik)\
**Post date:** [March 7, 2020, 8:13pm UTC](https://discourse.julialang.org/t/keyword-versus-positional-arguments/35538/3 "2020-03-07T20:13:32Z")

</div>

As far as I remember, all the code in the book was tested in 1.0. However, this difference was so narrow, that it wouldn’t surprise me if it has changed since.
