Freezing with Reason
#7

Quote:
Originally Posted by 1337pr0
Quote:
Originally Posted by backwardsman97
Why did you make the variable named "string" with a size of 256?

Quote:
Originally Posted by ssǝן‾ʎ
[anchor=i128]
  • Max input is 128
The SA:MP chat box has a maximum line length of 128, if someone types something you know it will never be longer than 128 ever. This includes text and commands, so why use a buffer twice that length to process the input?
Quote:
Originally Posted by Kye
I have decided to unsticky this topic because it was shown in an earlier benchmark that the performance difference between allocating 128 vs 256 cells was negligible. String allocation is unlikely to occur during any tight loops where most performance issues exist.

It's true that the chat/window buffer length is a maximum of 128, however it's dangerous in many languages to allocate buffers smaller or equal to the size of the original string. 256 is generally used to give 128 base length plus an additional 128 characters if anything further is appended.

It should be noted that anything sent to the client intended for the chat window that is greater than 128 characters will be ignored.

Program optimisation has been studied since the 1960s and they have found that most execution time and bottlenecks occur in the inner-most loop.
Touchй
Reply


Messages In This Thread
Freezing with Reason - by Robbin237 - 09.02.2009, 14:06
Re: Freezing with Reason - by ShizNator - 09.02.2009, 14:32
Re: Freezing with Reason - by Robbin237 - 09.02.2009, 14:58
Re: Freezing with Reason - by ShizNator - 10.02.2009, 00:14
Re: Freezing with Reason - by Backwardsman97 - 10.02.2009, 02:07
Re: Freezing with Reason - by 1337pr0 - 10.02.2009, 03:32
Re: Freezing with Reason - by Backwardsman97 - 10.02.2009, 03:41
Re: Freezing with Reason - by ShizNator - 10.02.2009, 11:19
Re: Freezing with Reason - by Robbin237 - 10.02.2009, 13:56
Re: Freezing with Reason - by ShizNator - 10.02.2009, 13:59

Forum Jump:


Users browsing this thread: 1 Guest(s)