Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a56c599d0c669ac402b049c5002a5a057c5e107283f9a44b60f3aa255ce3b334
Ticket: c9663296fd31fbb2fa1ff1cf019b59f432983516
GrowStringBuffer and GrowUnicodeBuffer do not check for overflows
User & Date: apnadkarni on 2023-05-06 02:36:37
Changes

  1. icomment:
    Gustaf,
    
    I think certainly it would very much be of interest at some point, though probably not right away (question of priorities). There are a variety of expansion proposals in the literature as well as actual implementations and choosing one needs some amount of analysis and actual measurement which is time consuming.
    
    With respect to reducing the factor as allocations grow, the amortization analysis I've seen that prove O(1) complexity depend on a constant growth factor (> 1). I am not good enough in complexity analysis to know if that still holds good if that factor is not constant but dependent on allocation size.
    
    However, the resizing / expansion algorithm is now in just one place for strings and lists (TclUpsize* functions in tclInt.h) so experimenting is a little easier as code does not have to change in multiple places.
    
    I had missed the expansions in DString so thanks. That needs to be updated.
    
    I had also not realized the implications about thread contention.
    
    /Ashok
    
  2. login: "apnadkarni"
  3. mimetype: "text/plain"