When do you worry about stack size?

前端 未结 19 988
难免孤独
难免孤独 2020-12-10 12:41

When you are programming in a language that allows you to use automatic allocation for very large objects, when and how do you worry about stack size? Are there any rules o

相关标签:
19条回答
  • 2020-12-10 13:48

    I don't. Worrying about this things whilst writing programming normal things is either a case of premature pessimization or premature optimization. It's pretty hard to blow things up on a modern computer anyway.

    I once wrote a CSV parser and whilst playing around with trying to get the best performance I was allocating hundereds of thousands of 1K buffers on the stack. The performance was stellar but the RAM went up to about 1GB from memory from normal 30MB. This was due to each cell in the CSV file had a fixed size 1K buffer.

    Like everyone is saying unless you are doing recursion you do not have to worry about it.

    0 讨论(0)
提交回复
热议问题