PR# 19076 [RJ] Suggestion for a speed improvement - dstop.

Problem Report Summary
Submitter: axarosenberg
Category: Runtime
Priority: Low
Date: 2015/05/29
Class: Feature Request
Severity: Non-critical
Number: 19076
Release: 15.01.9.6535
Confidential: No
Status: Analyzed
Responsible:
Environment: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Synopsis: [RJ] Suggestion for a speed improvement - dstop.

Description
The MSVC compiler inlines 'dstop' like this:

000007F79EBEF8CB 48 8B 44 24 30       mov         rax,qword ptr [rsp+30h]  
000007F79EBEF8D0 C7 40 04 03 00 00 00 mov         dword ptr [rax+4],3  
000007F79EBEF8D7 48 8B 44 24 30       mov         rax,qword ptr [rsp+30h]  
000007F79EBEF8DC 89 78 08             mov         dword ptr [rax+8],edi  

Note that the first and third instructions are identical (I was surprised).  We use "CFLAGS = -Ox -MT" and "VS Express 2013 for Desktop".  I wonder if it is because we are using 'Express'?  I haven't tried it, but you might change this:

	exvect->ex_linenum = break_index;
	exvect->ex_bpnested = 0;

to this:

	struct ex_vect *l_exvect = exvect;
	l_exvect->ex_linenum = break_index;
	l_exvect->ex_bpnested = 0;

Considering the number of times that 'dstop' is called, this could be a significant improvement in speed.  If you wanted to go nuts, you could probably make a union in "struct exvect" that maps 'ex_linenum' and 'ex_bpnested' into a single object that can be set in one shot.

Another idea would be to declare 'exvect' as a register.

Randy

To Reproduce

										
Problem Report Interactions
From:axarosenberg    Date:2015/06/17    Download   
Actually, it occurs to me that 'ex_bpnested' serves no purpose in F_Code.  Why not just get rid of it?
   Randy

From:manus_eiffel    Date:2015/06/01    Status: Analyzed    Download   
I'll definitely have a look in merging the 2 updates into just one. As for the suggestion to use `l_exvect', I'm not sure if it will change something since `exvect' is already a local variable.

From:axarosenberg    Date:2015/05/29    Download   
How silly of me, 'dstop' is only for W_Code.  I mean RTHOOK when finalized.  Still, a definition for 'l_exvect' could be added to the top of each routine or one of the other suggestions might work.
   Randy