Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: c4a0e16763c3f6ecbe2d2e7fbada6c98adcef587
Ticket: 2960042fffffffffffffffffffffffffffffffff
high water mark memory not shared for file I/O needs
User & Date: ferrieux on 2010-03-04 18:20:27
Changes

  1. icomment:
    Ah, address arithmetics, right.
    
    But this gives me an idea to circumvent the "iterate over pages" portability issue.
    Principle: use a private notion of "page" as an internal granularity inside our Tcl_Objs blocks. This granularity should be a power of two to allow for fast bitshift arithmetics. Then, each Tcl_Obj block is sprinkled with such "grain boundaries" (not necessarily in phase with the beginning of the block). At each position synchronized with this granularity, we reserve the Tcl_Obj slot (ie don't put it in free list) and instead, store the pointer to the current block structure in there.
    
    Consequence: the housekeeping metadata memory cost is on average one out of  sizeof(OURPAGE)/sizeof(Tcl_Obj), which may go down to a few bits per object, without playing dirty bitfield tricks (which is impossible becauseTcl_Objs don't have a single spare bit).
    
    Also, the block lookup time is roughly that of your OS-page-based scheme, very small (adress bitshift + 1 indirection).
    
    This "modulo" scheme only implies a bit more work at block allocation time (to skip the metadata slots), and possibly extra care to deal with the fact that sizeof(Tcl_Obj) is not a power of 2 (it's 24 on 32-bit cpus).
    
    
  2. login: "ferrieux"
  3. mimetype: "text/plain"
  4. username: "ferrieux"