how fast is within? does it use ray tracing?
I replied to another question shortly ago regarding performance. https://news.ycombinator.com/item?id=13285538
> does it use ray tracing?
No.
Frontloading computation into generating smart data structures give you better choices here.
The WITHIN call will be on average O(log(N)) because all objects are stored in an rtree. But it's usually very very fast to locate objects based on their outermost bounding area. The complexity of the object will add to the duration. Simple points are super fast, like sub microsecond fast in many cases. A MultiPolygon can be much slower.
Tile38 uses a modified raycasting algorithm, not raytracing for it's polygon detections.