You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Another potential use, that is likely already on your radar: If you can interpret the code, you can apply a cost function to it (while interpreting), which can provide feedback on how effective different optimizations are.
Different cost functions (loads are expensive vs. forward branches are expensive vs. instructions in general are expensive) can make the point to students that optimizations are architecture-specific.
I haven't thought about this one much, but adding such functionality could be neat and may not be terribly difficult? I figure it would essentially amount to just keeping a running total of costs incurred during step operations. The most primitive such cost function could just be counting the number of steps taken!
The text was updated successfully, but these errors were encountered:
On modern machines trying to predict the cost statically can be very hard. Not all loads are equal, and same for not all (forwards or backwards) branches. Because of out-of-order instruction execution in modern CPU pipelines, even arithmetic optimizations are often not nearly as effective as you would expect.
Yeah, that's a good point, though I can imagine employing some simplifying assumptions in a class setting to make a point. But maybe that's not worth the potential payoff... hm.
William Bowman actually uses an example of an "obvious" optimization that when you try and measure the performance impact of it ends up being indistinguishable from noise as a demonstration of this kind of thing. i.e. the wrong assumptions could potentially end up making the wrong point.
Via
@__gparmer
on Twitter:I haven't thought about this one much, but adding such functionality could be neat and may not be terribly difficult? I figure it would essentially amount to just keeping a running total of costs incurred during
step
operations. The most primitive such cost function could just be counting the number of steps taken!The text was updated successfully, but these errors were encountered: