# C implementation of function being ~4 times faster even absence of allocs

**URL:** https://discourse.julialang.org/t/c-implementation-of-function-being-4-times-faster-even-absence-of-allocs/126495
**Category:** Performance
**Tags:** ccall
**Created:** [March 3, 2025, 12:04pm UTC](https://discourse.julialang.org/t/c-implementation-of-function-being-4-times-faster-even-absence-of-allocs/126495 "2025-03-03T12:04:08Z")
**Posts on this page:** 1
**Showing post:** 25

<div class="post-metadata">

### Author: ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)
#### Post date: [March 5, 2025, 10:19am UTC](https://discourse.julialang.org/t/c-implementation-of-function-being-4-times-faster-even-absence-of-allocs/126495/25 "2025-03-05T10:19:17Z")

</div>

> [@sdanisch](#):
>
> Translating the C version 1:1 without findmax leads for me to a 12x speedup

So now it’s way faster than that C code (why?), but I’m not even sure it’s the limit of speedup.

I was thinking a naive\_findmax could be Base, or under findmax with keyword argument (and every time Base isn’t fastest for something, explain faster option available, without taking edge cases into account). But this seems to be a deep rabbit hole and maybe even faster here:

> [@Faster \`findmin\` without LoopVectorization.jl](https://discourse.julialang.org/t/faster-findmin-without-loopvectorization-jl/121742/11):
>
> If you want to avoid LoopVectorization.jl, you could always take [FindFirstFunctions.jl](https://github.com/SciML/FindFirstFunctions.jl/blob/24433207ec3d55bc20e6351b1e69b867e595632e/src/FindFirstFunctions.jl#L3-L74)’s approach. wink

At least document that findmax/min aren’t fastest, and point to alternatives (if not simply adding fastest) likely [FindFirstFunctions.jl](https://github.com/SciML/FindFirstFunctions.jl/blob/24433207ec3d55bc20e6351b1e69b867e595632e/src/FindFirstFunctions.jl#L3-L74) in their docstrings?

---

_[View the full topic](https://discourse.julialang.org/t/c-implementation-of-function-being-4-times-faster-even-absence-of-allocs/126495)._
