x (@x) / Twitter
twitter.com2 ポイント投稿者 FreeHugs1 コメント
for poly in polygon_subset:
if np.linalg.norm(poly.center - point) < max_dist:
close_polygons.append(poly) for poly in polygon_subset:
if np.linalg.norm(poly.center - point) < max_dist:
close_polygons.append(poly)
I don't think the entire feature set of the Python runtime is involved in this. def find_close_polygons(
polygon_subset: List[Polygon], point: np.array, max_dist: float
) -> List[Polygon]:
close_polygons = []
for poly in polygon_subset:
if np.linalg.norm(poly.center - point) < max_dist:
close_polygons.append(poly)
return close_polygons
And after replacing it with this Rust code, it is taking "an avg of 23.44ms per iteration": use pyo3::prelude::*;
use ndarray_linalg::Norm;
use numpy::PyReadonlyArray1;
#[pyfunction]
fn find_close_polygons(
py: Python<'_>,
polygons: Vec<PyObject>,
point: PyReadonlyArray1<f64>,
max_dist: f64,
) -> PyResult<Vec<PyObject>> {
let mut close_polygons = vec![];
let point = point.as_array();
for poly in polygons {
let center = poly
.getattr(py, "center")?
.extract::<PyReadonlyArray1<f64>>(py)?
.as_array()
.to_owned();
if (center - point).norm() < max_dist {
close_polygons.push(poly)
}
}
Ok(close_polygons)
}
Why is the Rust version 13x faster than the Python version? Wyre Payments, the company’s upstream payment
processor, terminated SpankPay’s account because
Wyre’s new payment processor, Checkout.com
doesn’t allow processing for payments related
to sexual businesses
SpankPay, Wyre, Checkoutcom ... How does this all work? What does the person who wants to pay a sex worker via SpankPay do? Do they use their usual Visa credit card or is the process different? The M2 money supply in Turkish liras is climbing,
but not in the same proportion as the rate cuts and inflation
Not? It looks like the money supply doubled over the last 12 months.
https://web.archive.org/web/20220906224326/https://twitter.c...