Initially, early BASIC interpreters only had a single byte at the beginning of a string to signify how long it was. That meant that it could have a length of zero bytes (0), up to a maximum length of 255 characters (255 decimal, FF in hexidecimal).
Since GWBASIC and BASICA, the number of bytes for the size of a string was extended to two or four. If two bytes, the maximum length of a string could be just under 32,767. That is because the two bytes were treated as a signed integer, and since you could not have a negative number of butes, only the positive values were allowed. In addition, the string might contain an identifier or a memory segment reference, so a full 32,767 bytes was not always permitted.
Some Languages supported an unsigned integer format to express the length, so that they could have string lengths up to 65,535 bytes.
As more memory was made available, it became possible to think in terms of even larger string structures, and some languages now support four bytes for a long representation of a string length. That would be 256^4-1, or 4,294,967,295 bytes in length. Again though, you have to consider whether the language treats this as a signed or unsigned value, as an signed value would allow just half the size of an un signed one. You also have to consider if the language has made the move to support Unicode, since each character in Unicode is two bytes long, not just one.
Keep in mind that working with strings, which have variable lengths, is not as efficient as working with fixed length structures, and it often pays to render string data into other forms to speed processing and improve performance. The longer the strings are, the more inefficient the results are likely to be. One principal reason is that if the processor can limit itself to integer indexing, it can work far more efficiently than if if has to somehow cope with offsets that require base address modifications or other techniques to extend its index range. This imposes a lot of overhead on the underlying processes that can seriously effect performance.
But sticking to a 255 maximum byte size is unnecessary and does not significantly impact on performance. That has not been a factor since the early days of microprocessors when we only had the old 6502, Z80, and 6800 processors which only had s single byte of index addressing and a few kilobytes of total memory space.
Since GWBASIC and BASICA, the number of bytes for the size of a string was extended to two or four. If two bytes, the maximum length of a string could be just under 32,767. That is because the two bytes were treated as a signed integer, and since you could not have a negative number of butes, only the positive values were allowed. In addition, the string might contain an identifier or a memory segment reference, so a full 32,767 bytes was not always permitted.
Some Languages supported an unsigned integer format to express the length, so that they could have string lengths up to 65,535 bytes.
As more memory was made available, it became possible to think in terms of even larger string structures, and some languages now support four bytes for a long representation of a string length. That would be 256^4-1, or 4,294,967,295 bytes in length. Again though, you have to consider whether the language treats this as a signed or unsigned value, as an signed value would allow just half the size of an un signed one. You also have to consider if the language has made the move to support Unicode, since each character in Unicode is two bytes long, not just one.
Keep in mind that working with strings, which have variable lengths, is not as efficient as working with fixed length structures, and it often pays to render string data into other forms to speed processing and improve performance. The longer the strings are, the more inefficient the results are likely to be. One principal reason is that if the processor can limit itself to integer indexing, it can work far more efficiently than if if has to somehow cope with offsets that require base address modifications or other techniques to extend its index range. This imposes a lot of overhead on the underlying processes that can seriously effect performance.
But sticking to a 255 maximum byte size is unnecessary and does not significantly impact on performance. That has not been a factor since the early days of microprocessors when we only had the old 6502, Z80, and 6800 processors which only had s single byte of index addressing and a few kilobytes of total memory space.