Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2007-04-04
20:21 • Ticket [1693802fff] INST_INVOKE speedup status still Closed with 4 other cha... artifact: 5898841795 user: msofer
11:06 • Ticket [1693802fff]: 4 changes artifact: 8e39930868 user: dgp
05:55 • Closed ticket [1693802fff]. artifact: 8a53cdffc4 user: msofer
00:51 • Ticket [1693802fff]: 4 changes artifact: 7e3fed1165 user: msofer
00:51 • Add attachment instInvoke.patch to ticket [1693802fff] artifact: 0e60ac7241 user: msofer
2007-04-03
17:51 • New ticket [1693802fff] INST_INVOKE speedup. artifact: 3fa8480ee8 user: msofer

INST_INVOKE speedup

Closed / Accepted1693802fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2007-04-03 17:51:10
Attached a patch that avoids calling out to TEOVi when possible.
msoferplain2007-04-04 00:51:12
File Added - 223596: instInvoke.patch
msofer Closed ticket [1693802fff]. [History diff]2007-04-04 05:55:57
dgpplain2007-04-04 11:06:35
Logged In: YES 
user_id=80530
Originator: NO


I dislike this.  Adding another
command dispatch location just
invites divergence, leading to
more problems like 582506.

I assume the speedup must be
compelling for you to go ahead
with this anyway.  Which suggests
it's our old mystery of "why do
function calls out of TEBC cost
so much?"  When the genie next grants
us wishes, I'd rather we figure that
out and solve that, than do things like this.

If you stick with this commit, at
least add some comments in
the TEOVI routine that any changes
made there need to be examined for
possible copying over to the
INST_INVOKE area.
msoferplain2007-04-04 20:21:29
Logged In: YES 
user_id=148712
Originator: YES

Those comments will be added, thank you.

I did not run the full benchmark suite, but did see 10-20% speed improvements in the OO microbenchmarks for different OO systems.

As to the mistery about "calling out of TEBC is expensive", my comments are:

(1) that is surely a bad explanation: the new code does one function call out of TEBC (possibly more), just like the old one

(2) here we are inlining a very specialised version of TEOvI: flags==0, no traces, the Command is already known to exist and known. IOW, we are replacing a 100+ loc function (assuming ~50% comments) with 10 loc in TEBC. In Chuck Moore's manner of speaking: we are deciding many things at edit time (like flags=0) instead of checking at run time.

(3) Very aggressive refactoring could be a different way of attaining similar results, but I am not sure that TEOvI_reallyInternalCircle0Ex() would be an addition that would make maintenance much easier ;)

My guess is that (2) has positive effects on cache behaviour, possibly depending on how clever the compiler/cpu combination is about prefetching. The effect might also be obtained with good compiler hints, but those tend to be non-portable (eg, gcc's __builtin_expect for branches) and also harder to maintain.
Log in (anonymous is fine) to add a comment.

Attachments: