Skip to content

3-arg hypot slower than 4-arg #47917

@sethaxen

Description

@sethaxen

For some reason calling hypot with 3 args on Julia v1.9.0-alpha1 is ~4x slower than calling it with 4 args:

julia> using BenchmarkTools

julia> foo(x) = hypot(x, x, x, x);

julia> bar(x) = hypot(x, x, x);

julia> @btime foo($(Ref(1.0))[]);
  8.309 ns (0 allocations: 0 bytes)

julia> @btime bar($(Ref(1.0))[]);
  25.234 ns (0 allocations: 0 bytes)

version info:

julia> versioninfo()
Julia Version 1.9.0-alpha1
Commit 0540f9d7394 (2022-11-15 14:37 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, tigerlake)
  Threads: 8 on 8 virtual cores

Metadata

Metadata

Assignees

No one assigned

    Labels

    mathsMathematical functionsperformanceMust go faster

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions