mbeckerle commented on PR #1427:
URL: https://github.com/apache/daffodil/pull/1427#issuecomment-2648965807

   > > We need O(1) reduceToSize, not O(n).
   > 
   > reduceToSize was removed in 2.13 and replace with trimToSize, which is not 
available in 2.12. Both according to chatGPT, reduceToSize was only O(!) if no 
changes were necessary, in general it was O(N-n). As far as why I picked slice, 
it was the closest equivalent to functionality for both 2.12 and 2.13
   
   "If no changes were necessary" means if no array internal data structures 
need resizing. Which is almost never. It is effectively O(1).  Yes it is worst 
case an O(n) operation, but that's really not of interest. 
   
   Slice is O(n) in the slice size every time it is called. 
   
   


-- 
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]

Reply via email to