Tcl Source Code

View Ticket
Login
Ticket UUID: 8994c972ad3df0aff53739fce486e39809a7b752
Title: Performance regression in the expr in/ni operator in Tcl 9
Type: Bug Created on: 2026-03-11 14:02:52
Submitter: apnadkarni Assigned to: nobody
Subsystem: 16. Commands A-H Severity: Important
Priority: 5 Medium Last modified: 2026-03-13 02:48:13
Status: Closed Closed by: apnadkarni
Resolution: Fixed Closed on: 2026-03-13 02:48:13
Version: 9.0
Description:

Compare 8.6

% timerate -calibrate {}
0.03480732249997189 µs/#-overhead 0.035377 µs/# 55176756 # 28266780 #/sec
% set l [lrepeat 1000 x]; timerate {expr {"a" in $l}}
6.619428 µs/# 150279 # 151070 #/sec 994.761 net-ms

with 9.0

% package req Tcl
9.0.2
% set l [lrepeat 1000 x]; timerate {expr {"a" in $l}}
9.195111 µs/# 108328 # 108753 #/sec 996.088 net-ms
User Comments:
apnadkarni added on 2026-03-11 15:45:53:

Proposed fix in 9893f7e1e7.

 timerate -calibrate {}
0.03631045936580007 µs/#-overhead 0.036670 µs/# 53231733 # 27270355 #/sec
% package req Tcl
9.0.4
% set l [lrepeat 1000 x]; timerate {expr {"a" in $l}}
4.169346 µs/# 237791 # 239845 #/sec 991.433 net-ms