On Fri, Jun 27, 2008 at 12:22 PM, Alex Villací­s Lasso <
[EMAIL PROTECTED]> wrote:

> Dan Kegel escribió:
> > Under Valgrind, on my nice fast e7200 system,
> > the entire suite of tests takes about three hours to run.
> >
> > The slowest ten percent of the tests take over a third of the runtime.
> >
> > riched20's editor.c in particular spends way too long
> > (I think) on test_EM_AUTOURLDETECT.
> >
> > The min, median, and max times to run a test
> > are 10 seconds, 19 seconds, and 15 minutes.
> >
> > 15:44.05elapsed riched20.dll editor.c
> > 6:35.94elapsed d3d9.dll visual.c
> > 5:45.43elapsed shell32.dll shlexec.c
> > 3:28.98elapsed kernel32.dll process.c
> > 2:49.85elapsed winmm.dll wave.c
> > 2:32.18elapsed kernel32.dll debugger.c
> > 2:14.41elapsed gdiplus.dll font.c
> > 1:44.54elapsed dsound.dll capture.c
> > 1:29.51elapsed mshtml.dll dom.c
> > ...
> > 0:18.84elapsed shlwapi.dll path.c
> > 0:18.83elapsed rpcrt4.dll cstub.c
> > ...
> > 0:09.92elapsed ntdll.dll path.c
> > 0:09.92elapsed msvcrt.dll data.c
> >
> > I guess I'm not complaining, but perhaps we could tone
> > down test_EM_AUTOURLDETECT a bit.
> >
> >
> I agree that the tests could be toned down. I am open to suggestions on
> what kind of toning down should be implemented. Personally, I would keep
> full testing for WM_SETTEXT, but use just one valid URL for the rest of
> the messages (WM_CHAR, EM_SETTEXTEX, EM_REPLACESEL). All of the known
> delimiters should still be tested in full. Also, there should be a way
> to re-enable full testing for all cases, maybe through an enviroment
> variable.
>

Rather than using one URL for all the messages, you could also cycle through
URL after testing them initially.  It would have the same performance of
using the same valid URL, but keeps the variety in the test.

I am attaching a rough patch to show what I mean, and so I can give everyone
an idea of the impact this type of change makes.  The following are times
from calling runtest for the editor tests of riched20.dll before and after
the patch.

Before:
real    1m6.924s
user    0m42.067s
sys    0m7.148s

After:
real    0m11.539s
user    0m3.876s
sys    0m0.956s

Hope this helps.

Because the patch is rough I am not posting it to wine-patches.  Feel free
to use or not use it.
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 0a45688..3f1f8d1 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -1370,6 +1370,7 @@ static void test_EM_AUTOURLDETECT(void)
   int i, j;
   int urlRet=-1;
   HWND hwndRichEdit, parent;
+  SETTEXTEX st;
 
   /* All of the following should cause the URL to be detected  */
   const char * templates_delim[] = {
@@ -1456,12 +1457,9 @@ static void test_EM_AUTOURLDETECT(void)
     SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) urls[i].text);
     check_CFE_LINK_rcvd(hwndRichEdit, urls[i].is_url, urls[i].text);
   }
-  DestroyWindow(hwndRichEdit);
+  i = 0;
 
   /* Test detection of URLs within normal text - WM_SETTEXT case. */
-  for (i = 0; i < sizeof(urls)/sizeof(struct urls_s); i++) {
-    hwndRichEdit = new_richedit(parent);
-
     for (j = 0; j < sizeof(templates_delim) / sizeof(const char *); j++) {
       char * at_pos;
       int at_offset;
@@ -1511,6 +1509,7 @@ static void test_EM_AUTOURLDETECT(void)
             "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, 
end_offset +2, buffer);
         }
       }
+      i = (i + 1) % sizeof(urls)/sizeof(struct urls_s);
     }
 
     for (j = 0; j < sizeof(templates_non_delim) / sizeof(const char *); j++) {
@@ -1552,6 +1551,7 @@ static void test_EM_AUTOURLDETECT(void)
             "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, 
end_offset +2, buffer);
         }
       }
+      i = (i + 1) % sizeof(urls)/sizeof(struct urls_s);
     }
 
     for (j = 0; j < sizeof(templates_xten_delim) / sizeof(const char *); j++) {
@@ -1607,11 +1607,9 @@ static void test_EM_AUTOURLDETECT(void)
             "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +2, 
end_offset +3, buffer);
         }
       }
+      i = (i + 1) % sizeof(urls)/sizeof(struct urls_s);
     }
 
-    DestroyWindow(hwndRichEdit);
-    hwndRichEdit = NULL;
-  }
 
 #define INSERT_CR \
   do { \
@@ -1634,9 +1632,6 @@ static void test_EM_AUTOURLDETECT(void)
   } while (0)
 
   /* Test detection of URLs within normal text - WM_CHAR case. */
-  for (i = 0; i < sizeof(urls)/sizeof(struct urls_s); i++) {
-    hwndRichEdit = new_richedit(parent);
-
     for (j = 0; j < sizeof(templates_delim) / sizeof(const char *); j++) {
       char * at_pos;
       int at_offset;
@@ -1764,16 +1759,11 @@ static void test_EM_AUTOURLDETECT(void)
             "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, 
end_offset +2, buffer);
         }
       }
+      i = (i + 1) % sizeof(urls)/sizeof(struct urls_s);
     }
-    DestroyWindow(hwndRichEdit);
-    hwndRichEdit = NULL;
-  }
 
-  /* Test detection of URLs within normal text - EM_SETTEXTEX case. */
-  for (i = 0; i < sizeof(urls)/sizeof(struct urls_s); i++) {
-    SETTEXTEX st;
 
-    hwndRichEdit = new_richedit(parent);
+  /* Test detection of URLs within normal text - EM_SETTEXTEX case. */
 
     /* There are at least three ways in which EM_SETTEXTEX must cause URLs to
        be detected:
@@ -1837,6 +1827,7 @@ static void test_EM_AUTOURLDETECT(void)
             "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, 
end_offset +2, buffer);
         }
       }
+      i = (i + 1) % sizeof(urls)/sizeof(struct urls_s);
     }
 
     /* Set selection with X to the URL */
@@ -1891,6 +1882,7 @@ static void test_EM_AUTOURLDETECT(void)
             "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, 
end_offset +2, buffer);
         }
       }
+      i = (i + 1) % sizeof(urls)/sizeof(struct urls_s);
     }
 
     /* Set selection with X to the first character of the URL, then the rest */
@@ -1950,15 +1942,10 @@ static void test_EM_AUTOURLDETECT(void)
             "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, 
end_offset +2, buffer);
         }
       }
+      i = (i + 1) % sizeof(urls)/sizeof(struct urls_s);
     }
 
-    DestroyWindow(hwndRichEdit);
-    hwndRichEdit = NULL;
-  }
-
   /* Test detection of URLs within normal text - EM_REPLACESEL case. */
-  for (i = 0; i < sizeof(urls)/sizeof(struct urls_s); i++) {
-    hwndRichEdit = new_richedit(parent);
 
     /* Set selection with X to the URL */
     for (j = 0; j < sizeof(templates_delim) / sizeof(const char *); j++) {
@@ -2009,6 +1996,7 @@ static void test_EM_AUTOURLDETECT(void)
             "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, 
end_offset +2, buffer);
         }
       }
+      i = (i + 1) % sizeof(urls)/sizeof(struct urls_s);
     }
 
     /* Set selection with X to the first character of the URL, then the rest */
@@ -2065,11 +2053,11 @@ static void test_EM_AUTOURLDETECT(void)
             "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, 
end_offset +2, buffer);
         }
       }
+      i = (i + 1) % sizeof(urls)/sizeof(struct urls_s);
     }
 
     DestroyWindow(hwndRichEdit);
     hwndRichEdit = NULL;
-  }
 
   DestroyWindow(parent);
 }


Reply via email to