BufferedString Object

This object is mostly used when you have to add char by char to a string and you need to process large amount of data.

String concatenation in Hollywood is somewhat slow so I've implemented this class for speed up concatenation where there is the need to concatenate data, character by character, for example while decoding or encoding data.

This trick speed up a lot this operation, in my tests I was able to process strings with single character concatenation at around 18 Kb/s, using this system I was able to reach 680 Kb/s. Wow! :-D

  • HL.BufferedString:New()
  • BufferedStringObj:AddChar()
  • BufferedStringObj:Get()



BSObject = HL.BufferedString:New()

Create a new buffered string object.


  • BSObject : The new created object.




Add the character 'char' to the buffered string object.


  • char : The character string to add to the buffered string object



Returns the current contents of the buffered string object.


  • contents : Current buffered string contents.

Object Structure

Each object have the following structure :

HL.BufferedString =
  { dest = "",         ; Output buffer
    temp = "",         ; Temporary buffer
    len  = 400,        ; Temporary buffer length in characters (default = 400)
    tlen = 0           ; Current temporary buffer length

You can adjust the temporary buffer length by overwriting the field len in your object or in the root object HL.BufferedString, it the latter case all successive object creations will have the buffer length you have modified.

hollywoodlibs/helpers/bufferedstring.txt · Ultima modifica: 2016/10/21 19:25 da admin
CC Attribution-Noncommercial 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0