[GTALUG] Idiomatic programming versus micro-optimizations
Aruna Hewapathirane
aruna.hewapathirane at gmail.com
Fri Apr 9 14:55:02 EDT 2021
Hello Everybody,
On Fri, Apr 9, 2021 at 12:52 PM David Mason via talk <talk at gtalug.org>
wrote:
> On Apr 9, 2021, 11:51 AM -0400, Len Sorensen via <talk at gtalug.org>, wrote:
>
> But using a loop means you are telling the system how to do things,
> rather than telling it what you want done and letting it (usually) do
> a better job at the how. After all with a loop you are controlling the
> excution order of the processing. If done right you usually shouldn't
> need to care.
>
> Another fine example of this is with Rust where you can write very
> natural, idiomatic, safe, code and then trust the compiler to mostly
> optimize most perceived overhead away. In fact there are often
> optimizations that Rust can do that C compilers can’t do.
>
> Here is a very interesting series of articles where someone takes a
> heavily optimized C program, converts it to Rust - with progressively more
> idiomatic versions, and ends up with a Rust program 3% faster than C
> (clang) and 20% faster than C (gcc), then rewrites it using the natural
> Rust iterators rather than indexing loops and it’s now 27% faster than
> clang!! http://cliffle.com/p/dangerust/
>
> But yes functional languages require a different philosophy. Functional
> languages are not for people that want to micromanage the computer.
>
> The point is, apart from academic exercises, the percentage of people who
> *need* to micromanage the computer is getting vanishingly small. I would
> say measured in the low thousands, but hundreds is probably more accurate.
> Unless you’re writing a compiler, interpreter or for an application where
> the computer has to add no more than $0.25 to the cost of the product, you
> really shouldn’t care.
>
> It really is time for C to go away! But TIOBE doesn’t agree
> https://www.tiobe.com/tiobe-index/ with C back to #1 and assemble up to
> #14!!!! (While Rust is #29) Just shows how important my opinion is!!
>
>
This is simply an attempt to inform and educate ( i am not trying to start
any flame wars ). This article I feel describes aptly why C will not go
away.
https://drewdevault.com/2019/03/25/Rust-is-not-a-good-C-replacement.html
Thanks - Aruna ::
../Dave
> ---
> Post to this mailing list talk at gtalug.org
> Unsubscribe from this mailing list
> https://gtalug.org/mailman/listinfo/talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/talk/attachments/20210409/43bccbcc/attachment.html>
More information about the talk
mailing list