Skip to content

Comment on Making a StringBuffer in C, and questioning my sanityparent

Comments

I remember reading (decades ago) an extensive article in Software Practice and Experience reaching the same conclusion.

Or like Python shows there, 1.25+k which can be better (faster growth and less memory wasted) than both

1.25 of what? Do you mean 2.25*k == 9*k/4.

They say 1.25+k, in this context k will be some constant, suppose it's 16 bytes

Thus you might see a curve like 13, 32, 56, 86 - this curve is aggressive to start but then much gentler. Because it's so gentle it gets the re-use upside for medium sized allocations but it incurs a lot more copying, I can imagine in Python that might be a good trade.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.