afs commented on issue #1324:
URL: https://github.com/apache/jena/issues/1324#issuecomment-1178256526

   @new-javacc In https://github.com/javacc/javacc/pull/85 the apraoch is a 
level of indirection but with the advantage that there is no contents copy.
   
   The current reallocation strategy in javacc is `char[] newbuffer = new 
char[bufsize + 2048];`
   
   Following the example of `ArrayList.newCapacity`:
   ```
      int newSize = bufsize == 2048 ? bufsize+2048 : bufsize*1.5;
      char[] newbuffer = new char[newSize];`
   ```
   which does not have the redirection but does have a single continuous buffer 
(the backup concern on javacc/javacc#85) and the (current) cost of a copy on 
reallocation. It preserves the current usage experience but which grows faster 
beyond 6144 bytes (4096+2048).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to