I mean the condition that pairs the two objects by comparing their IDs, that's quite slow...
Of course Physics as well is slow in this case, but you should avoid having to rescope the objects multiple times.
As for math formulas, this has some good stuff:
For LOS, no, a cone is a range, and you can't do a range without multiple rays, which would decrease performance even further...
You could perhaps use one ray and scan from one side of this imaginary cone to another tho...
As for the idea of checking everything in between two lines, that's another equation entirely, it wouldn't be able to know if there's a obstacle in the middle.
An array based LOS would be more efficient I think.
The ghost target to the last known position, that's good yes, I was doing it on my pathfinding example.
Edit: Ah, another thing, 325 is the max physics enemies you can have, so you may need to use a rudimentary movement for enemies out of sight to improve performance and limit to 325 on screen.