Artifact 1e1a748ee2aa7de136b2631d04c09592ed672f12de594733f67f9d5107706847:
- File typeparse/tests_tclsh/t88_parties_produit.tcl — part of check-in [7a6b2e2ffd] at 2026-10-25 13:49:02 on branch tip-764_tcl90 — The two regressions have been addressed in v16f. `lassign $it(*)` has returned to its previous performance level. The object-based approach is now the fastest when using the compact format, though it remains slow in the standard format. `$P(*)`: Reading all components of a typed product now utilizes a shortcut when all its fields are simple (i.e., containing no sums, links, or `any` types). The result remains the same as before: a `list.T` if all fields share the same type, or a `list.any` of typed fields otherwise. For a `Sample` with three fields, the execution time drops from 2.4 µs to 0.7 µs. Other cases continue to follow the general processing path. `cstruct.c`: The object-based approach now uses `tclAnnotatedApi.h`, similar to `geo.c`. In the compact format, measurements are read directly from their storage slots. In the standard format, the process still goes through an intermediary layer that requests the full content of the batch from Tcl; only a true stub function would be able to read this content in-place. Measurements (in µs) for a batch of 10,000 items: Step Before (v16e) v16f (standard) v16f (compact) 5b `lassign $it(*)` 15,300 7,600 7,600 7 Object-based `cs::stats_obj` 2,400–2,800 1,900 20 6 Full chain `cs::stats` 1,600 1,200 280 In the compact format, the object-based approach (20 µs) is now faster than the encoding-plus-byte-stream chain (280 µs). It is even as fast as performing the calculation alone on data already available as bytes (17 µs). Verifications: All 66 tests pass, in both the standard and compact formats. The new `t88` test covers the scenarios involving `$P(*)`. The outputs are identical to those of v16b, with the exception of the three tests that count the generated instructions. cstruct/test.tcl produces the same output as v16b in both forms, and Valgrind reports no issues. A full Valgrind run reveals nothing new, and the complete `make test` suite shows the same 61 failures as the reference. (user: Florentis, size: 1180) [annotate] [blame] [check-ins using]
# t88 : $P(*) d'un produit typé (toutes ses parties) par le raccourci de # lecture : mêmes valeurs et mêmes types que le chemin général (types # différents : list.any des champs typés ; tous identiques : list.T), # produit imbriqué, forme compacte, lassign ; les autres formes ($P(*.x), # sommes, any) restent au chemin général. type def Sample {{int}id; {double}value; {int}flags} type def point {{double}x; {double}y} type def seg {{point}a; {point}b} type def {-compact}nuage list.point type def forme {{double}cote, {string}nom} type def boite {{forme}f; {int}n} proc montre {v} {list $v [type get $v] [lmap e $v {type get $e}]} proc p1 {s} {montre $s(*)} set {Sample}s 1 2.5 0 puts "mixte : [p1 $s]" set {point}p 1.0 2.0 puts "identiques : [p1 $p]" set {seg}g(a,b) {1.0 2.0} {3.0 4.0} puts "imbriqué : [p1 $g] [montre $g(*.x)]" set {nuage}N {0.5 1.5} {2.5 3.5} proc p2 {N} {set q [lindex $N 1]; montre $q(*)} puts "case : [p2 $N]" proc p3 {s} {lassign $s(*) a b c; list $a $b $c [type get $b]} puts "lassign : [p3 $s]" set {boite}bx(f,n) {cote}2.0 3 puts "somme : [p1 $bx]" proc p4 {s} {set s(value) 9.5; montre $s(*)} puts "après écriture : [p4 $s] $s"