[ros-kernel] Little speedup (Nope)

Waldo Alvarez Cañizares wac at lab.matcom.uh.cu
Mon Mar 29 17:12:42 CEST 2004


Hi Rick:
 
Notice that sometimes it is not enough with that. Sometimes it depends on the compiler or the switches to the compiler and sometimes a speed-up in one area gives you a slowdown somewhere else (I have seem things like optimizing code that almost never executes and break performance in code that does executes a lot). Sometimes a speedup using some computer gives you bad performance using another one. I agree that yes there is a need to speed up reactos and that some profiling is better than nothing but keep eyes open when doing it, the mere act of changing existing code can break working code and could break it's performance too. I suggest to take a look at those Intel optimization manuals, some things are for assembler programmers but some can be applied to high level programming (there's stuff for OS programmers too), also a study of the compiler generated code can give you hints on were to change things (a warning, try several switches before making a long optimization session or you could waste your time)
 
I also want to say a few words about the following commit:
 
Commit in reactos/subsys/win32k/dib on MAIN	
dib1bpp.c	 +6	 -3	 1.15 -> 1.16	
- Fixed non-SRCCOPY BitBlts to 1bpp surfaces.
________________________________

reactos/subsys/win32k/dib

dib1bpp.c 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- dib1bpp.c	21 Mar 2004 04:17:33 -0000	1.15
+++ dib1bpp.c	28 Mar 2004 23:24:57 -0000	1.16
@@ -16,7 +16,7 @@

  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: dib1bpp.c,v 1.15 2004/03/21 04:17:33 royce Exp $ */
+/* $Id: dib1bpp.c,v 1.16 2004/03/28 23:24:57 navaraf Exp $ */
 
 #undef WIN32_LEAN_AND_MEAN
 #include <windows.h>
@@ -376,9 +376,12 @@

 				if (UsesSource)
 				{
 					Source = 0;
-					for (k = 0; k < 32; k++)
+					for (k = 0; k < 8; k++)
 					{
-						Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left) + k, sy, ColorTranslation) << k);
+						Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left) + k, sy, ColorTranslation) << (7 - k));
+						Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left) + k + 8, sy, ColorTranslation) << (8 + (7 - k)));
+						Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left) + k + 16, sy, ColorTranslation) << (16 + (7 - k)));
+						Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left) + k + 24, sy, ColorTranslation) << (24 + (7 - k)));
 					}
 				}
 				if (UsesPattern)
I think that something can be done about that loop unrolling. I mean, the compiler can unroll loops automatically, at least GCC can (maybe there is  a pragma or something to do it in a more controlled way, I do not have the documentation around)

i.e.
 
I have not tested it or even compiled (I do not even know what that code doessince i don't have the sources around) but this should be equivalent to the new commit
 
for (k = 0; k < 32; k++)
{
  Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left) + k, sy, ColorTranslation) << (7 - k));
}
 
Best regards
Waldo Alvarez
________________________________

From: ros-kernel-bounces at reactos.com on behalf of Rick Parrish
Sent: Mon 3/29/2004 2:44 PM
To: ReactOS Kernel List
Subject: Re: [ros-kernel] Little speedup (Nope)



Waldo Alvarez Cañizares wrote:

>little speed-up
> 
>
It would be nice if any speed up claims could be backed by some actual
profiling or benchmark, but the spirit of Thomas' changes are greatly
appreciated.

-rick


_______________________________________________
Ros-kernel mailing list
Ros-kernel at reactos.com
http://reactos.com/mailman/listinfo/ros-kernel


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 8315 bytes
Desc: not available
Url : http://reactos.com:8080/pipermail/ros-kernel/attachments/20040329/44b9869b/attachment.bin


More information about the Ros-kernel mailing list