How does view() determine if an object is visible to the center object or not?

I tried to make my own View() proc, and how it determines if the objects are visible is to draw a line of turfs from the center object to the target object, and if any of those turfs are opaque then it will not add the target object to the final list that View() returns.

But it was so incredibly laggy it was ridiculous. How does view() do it?

If I already have a reference to an object and I want to check if it is "viewable" how would I without doing if(object in view())?
I can't comment on how view works, but the reverse of view() is viewers() (If you have the object, and want to know if it can be seen by another, this returns a list of things than can see it.)
The only thing that discourages me from using viewers() instead of view() is this article ( ) that says they tested both and that viewers() is significantly slower than view()

Maybe someone can tell me how view() deals with objects hidden behind opacity, because it must not be the same as how I did it. (Drawing a line of turfs to the target object and stopping if one of those turfs is opaque)