I don't know the context you want to use the code in, but I would not focus on speed just yet. All code examples have one or more issues:
- Bulges are not taken into account.
- Polylines may not be bisected by other polylines.
- The polyline must have an edge between the point and extmin.
- The polyline must be rectangular.
...
Sorry for the delay but I do not see my reply (about 5 hours ago) so I rewrite it:
The contest is my sample DWG:
ok - Bulges are not taken into account.
ok - Polylines may not be bisected by other polylines.
ok - The polyline must have an edge between the point and extmin.
No - The polyline must be rectangular.
Not true but many functions works in this situation. If there is a function that satisfies all it is better...
Thanks