[geos-devel] Benchmark between various geometry libraries
Hartmut Kaiser
hartmut.kaiser at gmail.com
Wed Nov 18 14:14:51 EST 2009
> Thanks for clarifying this, Hartmut. This makes good sense to me. In
> my (admittedly limited and dated) experience, the C/C++ heap allocator
> (good ol' malloc still, right?) is pretty slow. From what you're
> saying
> stack allocation is substantially faster.
It's not that allocation is necessarily slow it's that GEOS is doing _a lot_ non-necessary allocations. And no allocation (putting the instances on the stack results in no allocation) is always faster than the fastest one available :-P
> The kind of change you indicated should be fairly simple to make in the
> GEOS codebase.
Agreed.
> I'd be interested to see how widespread this actually is. Many of the
> structures that JTS/GEOS creates during processing are shared across
> multiple methods and classes. I suppose this doesn't preclude using
> stack-based allocation, but mightn't it require passing more references
> down into function calls?
Sharing is certainly a bit trickier this way, but allocating on the stack helps defining proper ownership of the data.
Regards Hartmut
-------------------
Meet me at BoostCon
http://boostcon.com
More information about the geos-devel
mailing list