NUMBER_TOKEN seconds what happened how is that NUMBER_TOKEN seconds is that should i take a screenshot like before or not it looks the same doesn't it what on earth let's quickly run a profile over that what i mean i have never used a cd accumulator before like ever i don't think i've come across it but i've never actually written it before is it really that slow is there a bug in this msvc library or something what's going on why is it so fast now and that's not even this is still running on half my cause but look at this so where are we spending the time in now hit a list hit still okay so object hit is taking up NUMBER_TOKEN percent as you would expect and then let's just expand that hot path sphere hit okay this is this looks better so you can see that we're actually okay so some of this optional stuff might be slowing us down a little bit you can see it's taking like three percent maybe i wouldn't use optional as well but you can see that we're more or less inside this function now because we can see that we're calling hit and it's being called and again those samples this is a sampling profiler most of those samples NUMBER_TOKEN are ending up within this function right and then the rest by the way are probably also ending up within that function but in a different stack frame so really they're all ending up within that sphere hit function which is again what you would expect now to take this a little bit further i wouldn't use uh optionals here at all right because what you're doing is you're saying that in certain cases right let's just return like an optional with no value and then that way obviously back here we can use that uh if statement that we had here right well we're still using it here we can use this if statement to determine that it was not hit so therefore you know whatever let's not update the record and you know because there was something that was closer i guess or whatever or it just didn't work out so we return optional here we return optional here as well find the nearest route lies in the acceptable range sure i probably wouldn't do that and then also you're creating a hit record here and then you're returning it packaged inside an optional what i would probably do is basically bring out like a hit record like this maybe set some kind of like default value for t like minus one or something um this returns an optional that's fine because obviously this isn't per pixel or whatever i assume well this is per object maybe this would be maybe we don't want to return an optional here as well but if we did we probably could just check t if it's negative one let's return you know a blank optional however you even do that which i guess is well you did that before so it's just this otherwise we'll return that record or something like that and then we'll pass this record as the kind of uh you know target of this hit so that way we don't have to create a hit record copy it do all of that stuff it's already within this stack frame and then also it means that we uh you know we don't need to return optionals or do anything like that which seems to be taking up some some of the uh profiling cycles that we can see over here right we don't
NO_SEGMENT_TOKEN