Elektrine lite

← Feed

@saagar@federated.saagarjha.com

Post #2598508

2023-03-19 09:50 UTC

@slomo@toot.cat Notably, it can check early if either value is zero and avoid the expensive computation. With LTR evaluation, if /* something */ was not zero, you’d still have to call do_expensive_thing before you could exit.

Replies (1)

  • @slomo@toot.cat 2023-03-19 10:02

    @saagar@federated.saagarjha.com Thanks for the concrete example. If do_expensive_thing() has no observable side effects in this context (i.e. nothing but its return value), then a compiler could still do that. If it has observable side effects then I would argue that allowing the compiler to reorder randomly is a worse outcome than specifying an order. Apart from reproduceability of the the side effects in different environments and with different compilers / compiler flags, you probably don't want the runtime of your application to depend on such a brittle optimization. But I can see that someone else might have a different opinion on that. I hope I don't have to ever deal with bugs in their code though 😅​

    Open ##2598509