Tcl Source Code

Ticket Change Details
Login
Overview

Artifact ID: 3b7a57eb57f407bbb71ebaa61f8cadea76590f0004e0246f5e6f3bcc672b8b32
Ticket: 28cc67a606a7ab771af4c7b542b34ec1a377edc7
array set from dict: set values multi times on the same array is slower with Tcl9.0.
User & Date: sebres 2024-04-16 17:22:57
Changes

  1. icomment:
    This definitely belongs to abstract-lists implementation of 9.0 and although it was supposed to be better (avoid shimmer of dict to list), in the reality it is rather worse now:
    
    - list facilities previously handles pure-dicts better (even if it shimmered sometimes between list/dict).
    - by retrieving of length (DictAsListLength) now it always obtain string representation of dict (also for pure-dict object), what:
       * may be slow and 
       * causes that dict object is not pure anymore (basically we need a flag for that, to mark pure-dicts independently to existence of its string representation)
    - DictAsListLength (but basically ObjType::LengthProc) cannot handle errors, what may be not so good for a possible fallback (if dict is not pure dict);
    - retrieving of index (if one would implement it for dict), e. g. for INST_FOREACH_STEP/INST_FOREACH_START instructions, is hardly possible, because
    normal iteration over the dict needs some interim Tcl_DictSearch (or similar iterator handle), and without that we'll get O(n!) aka factorial big-O if it'd always start from scratch and stop at index.
    - ObjType::GetElements may be too hard (for large dicts) and it is unused, and rightly so, for INST_FOREACH_STEP/INST_FOREACH_FIRST instructions.
    - there is no ObjType::Iterate facility.
    
    All that makes difficult to implement it with reasonable performance for all corner cases. However I'll take a closer look to this later.
    
  2. login: "sebres"
  3. mimetype: "text/x-markdown"