<div dir="auto"><div><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Tue, Sep 30, 2025, 8:48 PM Sam James <<a href="mailto:sam@gentoo.org">sam@gentoo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Amit <<a href="mailto:amitchoudhary0523@gmail.com" target="_blank" rel="noreferrer">amitchoudhary0523@gmail.com</a>> writes:<br>
<br>
> On Tue, Sep 30, 2025, 2:23 AM Wilco Dijkstra <<a href="mailto:Wilco.Dijkstra@arm.com" target="_blank" rel="noreferrer">Wilco.Dijkstra@arm.com</a>> wrote:<br>
><br>
>  Hi Amit,<br>
><br>
>  Modern compilers will optimize your example code away. You can see that<br>
>  there are no checks at all in the main function: <a href="https://godbolt.org/z/aeeTx6zqM" rel="noreferrer noreferrer" target="_blank">https://godbolt.org/z/aeeTx6zqM</a><br>
><br>
>  Even if it wasn't optimized, it wouldn't be possible to measure any difference.<br>
>  Running an empty main() in a loop will just measure shell overheads. Your<br>
>  results show it takes a few million cycles per iteration, so an extra check cannot<br>
>  be measured. What you're really measuring is the varying turbo frequency of<br>
>  your laptop...<br>
><br>
>  Benchmarking is hard, much harder than you think. It is  done by creating a<br>
>  tight loop around any code you want to measure. You have to use inputs that<br>
>  are representative of real usage (ideally from traces from actual workloads).<br>
>  For timing we use a high-resolution (nano-second) timer. You can look at<br>
>  recent benchmarks in benchtests/ that show how it should be done.<br>
><br>
>  Cheers,<br>
>  Wilco<br>
><br>
> I am not going to get into any discussion because I have learned that glibc people are defensive people and they will<br>
> defend their wrongdoings.<br>
<br>
I think Wilco's reply was respectful and professional. It's also<br>
accurate. I don't see it as defensive at all.<br>
<br>
><br>
> ------------<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">glibc/POSIX claim that checking arguments of functions lead to ""significant"" performance degradation and that's why they don't validate the inputs.</div><div dir="auto"><br></div><div dir="auto">But this claim is not proven.</div><div dir="auto"><br></div><div dir="auto">There is no data published by glibc/POSIX as to how much performance is gained by not validating the input.</div><div dir="auto"><br></div><div dir="auto">In absence of data from glibc/POSIX, I have come to the conclusion that this claim is false.</div><div dir="auto"><br></div><div dir="auto">I think glibc/POSIX should back up their claim by publishing the test code and the results so that people can also run the performance tests on their machines and verify glibc/POSIX claim.</div><div dir="auto"><br></div><div dir="auto">Please don't ask me to do it.</div><div dir="auto"><br></div><div dir="auto">Even if you people don't do it, it is fine with me.</div><div dir="auto"><br></div><div dir="auto">It is your claim and you should prove it.</div><div dir="auto"><br></div><div dir="auto">-------------------------------</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>