Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2006-10-14
09:20 • Closed ticket [1522510fff]: Tcl_ExprObj: avoid Tcl_GetStringFromObj plus 6 o... artifact: 0621e7bd5a user: sf-robot
2006-09-30
00:28 • Pending ticket [1522510fff]. artifact: 14473d8b73 user: msofer
2006-07-27
14:56 • Add attachment tclExecute.c.diff to ticket [1522510fffffffff|1522510fff... artifact: be5641e698 user: fridolin
14:56 • Ticket [1522510fff] Tcl_ExprObj: avoid Tcl_GetStringFromObj status still Ope... artifact: 3805e435d3 user: fridolin
14:56 • Ticket [1522510fff]: 4 changes artifact: de38de28c7 user: fridolin
14:43 • Ticket [1522510fff]: 4 changes artifact: 635c661c94 user: fridolin
14:43 • Add attachment recursive.tcl to ticket [1522510fff] artifact: 5b991af3fa user: fridolin
14:43 • Ticket [1522510fff] Tcl_ExprObj: avoid Tcl_GetStringFromObj status still Ope... artifact: 98b73015e2 user: fridolin
2006-07-17
21:25 • Ticket [1522510fff]: 4 changes artifact: 865a3404a4 user: dgp
2006-07-14
19:04 • Ticket [1522510fff]: 4 changes artifact: 95a3b11881 user: fridolin
19:04 • Add attachment avoid-getstringfromobj.diff to ticket [1522510fffffffff|... artifact: fc6fc533e7 user: fridolin
12:04 • New ticket [1522510fff] Tcl_ExprObj: avoid Tcl_GetStringFromObj. artifact: ed13a5e925 user: fridolin

Tcl_ExprObj: avoid Tcl_GetStringFromObj

Closed1522510fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2006-07-14 12:04:44
This patch avoids an call to Tcl_GetStringFromObj on 
byte-compiled expressions in Tcl_ExprObj (common 
path). It's speed up (slightly) the recursive 
benchmark from the "Computer Language Shootout". Not 
much, but the patch is very simple.
fridolinplain2006-07-14 19:04:44
File Added - 184921: avoid-getstringfromobj.diff
dgpplain2006-07-17 21:25:54
Logged In: YES 
user_id=80530


what version of Tcl sources is
the patch for?

The patch appears to be all about
replacing one form of special-case
optimization with some other form
of special-case optimization.
I don't know that that makes much
sense without some benchmarking
data guiding the way.

The old optimizations might
well be relics and better
removed, but some measurements
ought to tell us that.  Got any?

That said, Tcl_GetStringFromObj()
on a Tcl_Obj that already has
a string rep (which an expression
should) ought to be really cheap,
so I'd expect the patch to make
little difference.  What's the
data say?
fridolinplain2006-07-27 14:43:28
Logged In: YES 
user_id=13583

Sorry, the patch was done against tcl8.5a4.

Vefore submitting I made some test with the attached 
program, which does mostly expr-calculations. It is taken 
from the  "Computer Language Shootout".
fridolinplain2006-07-27 14:43:29
File Added - 186413: recursive.tcl
fridolinplain2006-07-27 14:56:32
Logged In: YES 
user_id=13583

The data are not very impressive.
 
Done under linux: with the patch:

clsh recursive.tcl 3  24,82s user 0,07s system 96% cpu 
25,661 total
tclsh recursive.tcl 3  24,30s user 0,03s system 97% cpu 
24,968 total
tclsh recursive.tcl 3  24,58s user 0,02s system 93% cpu 
26,280 total
tclsh recursive.tcl 3  24,61s user 0,04s system 93% cpu 
26,256 total

without the patch:
tclsh recursive.tcl 3  25,17s user 0,03s system 93% cpu 
27,031 total
tclsh recursive.tcl 3  25,10s user 0,07s system 92% cpu 
27,254 total
tclsh recursive.tcl 3  24,80s user 0,08s system 97% cpu 
25,541 total
tclsh recursive.tcl 3  24,78s user 0,05s system 96% cpu 
25,644 total

I'll upload a slightly simpler patch. There just a block is 
moved.
fridolinplain2006-07-27 14:56:53
File Added - 186414: tclExecute.c.diff

Logged In: YES 
user_id=13583

The data are not very impressive.
 
Done under linux: with the patch:

clsh recursive.tcl 3  24,82s user 0,07s system 96% cpu 
25,661 total
tclsh recursive.tcl 3  24,30s user 0,03s system 97% cpu 
24,968 total
tclsh recursive.tcl 3  24,58s user 0,02s system 93% cpu 
26,280 total
tclsh recursive.tcl 3  24,61s user 0,04s system 93% cpu 
26,256 total

without the patch:
tclsh recursive.tcl 3  25,17s user 0,03s system 93% cpu 
27,031 total
tclsh recursive.tcl 3  25,10s user 0,07s system 92% cpu 
27,254 total
tclsh recursive.tcl 3  24,80s user 0,08s system 97% cpu 
25,541 total
tclsh recursive.tcl 3  24,78s user 0,05s system 96% cpu 
25,644 total

I'll upload a slightly simpler patch. There just a block is 
moved.
msofer Pending ticket [1522510fff]. [History diff]2006-09-30 00:28:01
sf-robotplain2006-10-14 09:20:07
Logged In: YES 
user_id=1312539

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
Log in (anonymous is fine) to add a comment.

Attachments: