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: Cudder !cXCudderUE 2015-05-03 13:53

>>11
It's only easy if you don't think ahead. IRL this is like putting your things in one box, finding it's too small to hold everything, then getting a bigger one, taking things out of the old one and putting it into the bigger one, then seeing it still doesn't fit, getting an even bigger one, moving everything into it, ... If you kept doing this, you'd be called a retard before long.

This is absurdly low-hanging fruit. It's not even hanging. It's sitting on the ground.

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