Closed Ughuuu closed 3 weeks ago
But I remember seeing it in other functions too. @lilizoey said on discord:
in here, that final expect can be turned into an unwrap_unchecked() which should be safe and also avoids constructing any string names
i did try to do this but it actually didnt seem to improve performance much (in fact it seemed to make it slightly worse with a simple benchmark at least?). i suspect that rust might not be able to inline as well if we do that for some reason.
Not sure why it happens, @lilizoey has more insight, but it seems there are some casses that could be optimized out where we call
class_name::to_string_name
. In my performance investigation, things that should be no-op appear on the times instead. Specifically this happens inside theArray::clone
:But I remember seeing it in other functions too. @lilizoey said on discord:
in here, that final expect can be turned into an unwrap_unchecked() which should be safe and also avoids constructing any string names