20 ms·
One of the methods tested was mutate-struct -- Dereference a struct pointer and mutate both its fields.
by dmlorenzetti 13y ago
One of the methods tested was mutate-struct -- Dereference a struct pointer and mutate both its fields.
- acqq 13y agoThanks. I haven't seen the description under "Three Common Techniques." And I also claim that the benchmarking isn't giving the method the due justice as the benefits of it can be visible only in the context where you really do operate with more functions on the same structures. Moreover, I think it's better to simply know how the C is translated to the assembly then to measure one very limited example. Specifically, some optimizations avoid calling functions at all. But the measurements of such examples don't properly reflect the behavior in bigger programs, where it can be bigger performance benefit to have smaller code than a fast microbenchmark.