From: Glenn L. <pe...@ne...> - 2004-05-14 20:54:43
|
On approximately 5/14/2004 12:43 PM, came the following characters from the keyboard of Laurent ROCHER: > >>>I think it's not a problem to upgrade default stack buffer to 4096 by >>>default. >>>Stack allocation is generally same speed for 256 and 4096. >>>And only dynamicly allocate a buffer when desired size isn't enough. If performance were critical, or ever important, for this routine, I would agree. I agree anyway, but there is one other consideration.... > In this case (in GetOpenFilename context) speed difference it's not a > problem (Need to wait user interact with dialog). Do, it's possible to > always use safemalloc. The problem is that there are several exit points to the function, and each of them needs to do the buffer cleanup. So making a more complex technique, of having a static buffer, and allocating a dynamic one only when the static one isn't big enough, makes the buffer cleanup routine quite a bit bigger, and it has to be duplicated several times, or else the several exit points merged into one. Neither of those seem appealing, since performance isn't particularly important here. -- Glenn -- http://nevcal.com/ =========================== The best part about procrastination is that you are never bored, because you have all kinds of things that you should be doing. |