Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Protip: Compute the size before you allocate

Name: Cudder !cXCudderUE 2015-05-02 16:06

I've lost track of how many times I've seen code that uses a dynamically-expanding array when it could've easily calculated the correct size and allocated exactly the right amount. See: string appending, tokenising, just about everything written in JavaScript, etc.

No wonder software is so slow and bloated...

Name: Anonymous 2015-05-02 17:25

I always cringe inside a little when I write code dealing with strings. I have a vague obsessive fear inside of me, that all those use-once little strings that I have inside loops cause constant useless allocations and frees/garbage collection. But the worst is when I concatenate a string from lots of smaller strings and chars. I shudder at the thought that for every call of the concatenation function there's an allocation of a new use-once string happening...

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List