Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a1cd37584fbe1944282a94a3ab31dc5bb97ad23f4d2571a349acd1f843bc6b04
Ticket: db4f2843cdb28c27fddf511567bc9287484852ae
Sporadic segfault (BO) using tclIO
User & Date: sebres on 2024-01-26 22:48:43
Changes

  1. icomment:
    I added performance regressions tests for <code>read</code> in [492aaec52129ccbc], that illustrates pretty well the quadratic regression in absence of append (doubling of bytes in internal object used for read on every iteration).
    
    The result of execution (original 8.6 vs. previous fix without append) can be found as diff in [https://gist.github.com/sebres/0875a4a75c489b13b6cba8fc9adcc99a|gist.github.com/sebres/0875a4a75c489b13b6cba8fc9adcc99a].
    
    As one indeed can see the regression is pretty obvious (because of too many reallocs), but...<br/>
    
    It looks strange if one try to use larger buffersize:
    
    1. the regression is still quadratic even if large buffer size is used (1MB instead of 4KB), however it becomes a bit faster with larger buffersize.
    
    2. still worse is that even by original version with append, the usage of large buffersize degrades (whether I'd expect vice versa result), for example reading 10M blocks it takes 37ms/# by 4KB vs. 104ms/# by 1MB.
    
    So it looks like command <code>read</code> or rather <code>Tcl_ReadChars</code> internally use small chunks (a bit unexpected for my taste) or it has another issue yet (not directly related to the "append" or "realloc" predicament).
    
  2. login: "sebres"
  3. mimetype: "text/x-fossil-wiki"