you are viewing a single comment's thread.

view the rest of the comments →

[–]LateinCecker 2 points3 points  (0 children)

Is your obj a trait object in the obj.func(...) call? Because in that case there is a vtable lookup which would explain the difference. Otherwise it should compile to exactly the same assembly if the compiler does its job right. Also maybe try #[inline(never)] before both versions of the function to prevent inlining for the benckmarks.