Overview
| Comment: | Version 16h is ready: your declaration will now be accepted, and it works for any number of dimensions you require. ```tcl type def {-compact}matrix2 list(3).list(3).double set {matrix2}M {1 2 3} {4 5 6} {7 8 9} ;# normalized to {1.0 2.0 3.0} ... type is {compact?}$M ;# 1 expr {$M(0.0) * $M(1.1) + $M(2.2)} ;# 14.0, read from the storage cell set M(1.2) 60.5 ;# written to the storage cell lindex $M 1 2 ;# 60.5: a row remains a list ``` **How it is stored** An element of type `list(n).T` is stored like a C array `T[n]`, provided that `T` itself can be laid out in storage cells—whether it is a scalar, a product, or another fixed-size list. Example: `list(2).list(3).list(2).int(s,32)` results in the equivalent of `int32_t[2][3][2]`. A product containing a field `{list(2).double}v` is now stored entirely within its cells. A single cell can contain a maximum of 4,096 parts. A 100×100 matrix is accepted (100 cells of 800 bytes each), while `list(2).list(5000).double` is rejected, with an error message explaining why. `tcl::unsupported::compact layout` displays the parts using `i.j` notation. For a parameterized family, you must use a named instance: `type def {-compact}mat3 mat(3,3)` works as expected. ** Performance** |Operation |Before | v16h| |!---|---:|---:| |Reading $M(i,j)| 0.9 µs| 0.23 µs| |Setting M(i,j) to a number| 2.2 µs| 0.14 µs| |Product of two 3×3 matrices (cell-based)| 89 µs| 33 µs| |The same product (standard form)| 113 µs| 75 µs| Reading occurs directly from the cell, including for operands compiled as `loadFieldNum` within an expression. Writing occurs in-place only if no other reference to the value exists—meaning no copies and no active views. Otherwise, the system reverts to the previous approach. Traces and the established contract are fully respected. The same 3×3 matrix product, when performed using raw lists (`lindex`/`lset`), takes 9 µs; this remains approximately 3.5 times slower than "bare" Tcl. **Two bugs fixed** `lset L i j v` on a list stored in cells was reading from deallocated memory. This bug already existed in v16g with products—for example, `lset P 0 1 5.0` on a compact `list.point`—and was identified using Valgrind. `lindex $M i j` was losing the element read from the cell, resulting in a memory leak—also detected by Valgrind. **Verifications** New test `t90_listes_fixes_en_cases`: each operation is performed on both a matrix stored in cells and its standard counterpart. This includes 3D cases, specific data types (e.g., `binary`), compact cells, and in-place writes (where a view, a copy, or an element already traversed retains the old value, while a "trace" reflects the new one). `t70_compact` and `t72_compact_type`: expected output updated; only the text of the rejection message has changed. All 68 tests pass in both modes, and every file produces identical output regardless of whether the compact format is used. Valgrind reports no issues, aside from the standard, recurring warning from `executable_pe.tcl` upon exit. `make test` continues to yield the same 61 failures. |
|---|---|
| Timelines: | family | ancestors | descendants | both | tip-764_tcl90 |
| Files: | files | file ages | folders |
| SHA3-256: |
1972295ee97441d2f9491160830d86c6 |
| User & Date: | Florentis on 2026-10-26 04:24:01.824 |
| Other Links: | branch diff | manifest | tags |
Context
|
2026-10-26
| ||
| 06:42 | The `examples/matrices/` example is ready, and all 22 checks in its `test.tcl` script pass. During p... check-in: 7f8d29abf6 user: Florentis tags: tip-764_tcl90 | |
| 04:24 | Version 16h is ready: your declaration will now be accepted, and it works for any number of dimensio... check-in: 1972295ee9 user: Florentis tags: tip-764_tcl90 | |
|
2026-10-25
| ||
| 18:18 | Version 16g has been released. The `set {point}A 1.0 2.0` operation has improved from 1.3 µs ... check-in: 2cbd5d6000 user: Florentis tags: tip-764_tcl90 | |
Changes
Modified typeparse/REPRISE.md
from [e1d756c82d]
to [2af6c8f7f9].
[diff]
Modified typeparse/VERSION
from [ae47b74d19]
to [c395e73149].
[diff]
Modified typeparse/doc/ANNOTATIONS.fr.md
from [7657faa702]
to [4919664d22].
[diff]
Modified typeparse/noyau/LISEZMOI.md
from [e8afe0c23b]
to [dcc2a872ee].
[diff]
Modified typeparse/tclAnnotObj.c
from [acc8ff538b]
to [60f8c4ab47].
[diff]
Modified typeparse/tclTypePath.c
from [97ebca5fd9]
to [d5e097ec7c].
[diff]
Modified typeparse/tclTypes.c
from [7a22ed367f]
to [3e634320d9].
[diff]
Modified typeparse/tclTypes.h
from [d328674a3b]
to [333e8f75ea].
[diff]
Modified typeparse/tests_tclsh/t70_compact.out
from [a5f8be491c]
to [88ba2ee9b7].
[diff]
Modified typeparse/tests_tclsh/t72_compact_type.out
from [c482a1ec83]
to [d6dd554948].
[diff]
Added typeparse/tests_tclsh/t90_listes_fixes_en_cases.out version [41f50ab2b4].
Added typeparse/tests_tclsh/t90_listes_fixes_en_cases.tcl version [4d1c43c441].