VS2010 bug - very slow after revision 66187

Oct 27, 2011 at 12:50 PM
Edited Oct 27, 2011 at 1:19 PM

here is bug2 that I found at VS2010.

I build my application with VS2005, it works good with VLD 2.2 (also good with revision #70983)

but when I build with 2010, vld got really slow.

and I takes too much time to start my application and it's going to be useless at real world.

I got a several revison from #65158 to #70983

I built and tested all version, I found #66187 was OK, #66190 was slow.

The main difference is patchimport function in Utility.cpp.

The new patchimport funcion was called too many times (more than 3M times) in my application .

after I changed patchimport to old one, everything works ok. (patchimport was called around 10,000 - 100,000)

 

can you check it?

Coordinator
Oct 27, 2011 at 2:35 PM

So problem in patchimport or in function that call patchimport?

http://vld.codeplex.com/SourceControl/changeset/view/66190#1121838

Oct 27, 2011 at 3:18 PM

sorry for mis-describing bug.
slow bug is made by patchimport in revision #66190

patchimport function in #66187 was using findimportdescriptor function.
findimportdescriptor was removed at #66190. but there is performance problem.


here is short description

======================================================================================
#66187
IMAGE_IMPORT_DESCRIPTOR* findimportdescriptor (HMODULE importmodule, LPCSTR exportmodulename)
{
idte = (IMAGE_IMPORT_DESCRIPTOR*)ImageDirectoryEntryToDataEx((PVOID)importmodule, TRUE,
if (idte->FirstThunk == 0x0) {
return NULL;
}
return idte;
}

BOOL patchimport (HMODULE importmodule, moduleentry_t *module)
{
idte = findimportdescriptor(importmodule, exportmodulename);
if (idte == NULL)
return FALSE; //return here many times.

while(entry->importname)
{
do time consuming jobs here
}

return result > 0;
}
======================================================================================
#66190

BOOL patchimport (HMODULE importmodule, moduleentry_t *module)
{
idte = (IMAGE_IMPORT_DESCRIPTOR*)ImageDirectoryEntryToDataEx((PVOID)importmodule, TRUE,
IMAGE_DIRECTORY_ENTRY_IMPORT, &size, §ion);

if (idte == NULL) {
return NULL;
}
int result = 0;
while (idte->FirstThunk != 0x0)
{
do time consuming jobs here
}

return result > 0;
}
======================================================================================
can you find the differences?
patchimport was called serveral Million times in all cases,

patchimport(#66187) returns quickly most of times, due to idte == NULL.
and did time consuming jobs 10,000 - 100,000 times.

but patchimport(#66190) did time consuming jobs at most of times.

that makes huge performance problem.

--------- 원본 메일 ---------
보낸사람: "KindDragon"<notifications@codeplex.com>
받는사람 : hskim70@hanmail.net
날짜: 27 Oct 2011 07:36:01 -0700
제목: Re: VS2010 bug - very slow after revision 66187 [vld:277408]


Coordinator
Oct 27, 2011 at 3:23 PM

This is because revision #66187 contain bug in patchimport and not process all entries, we fix this in revision #66190. Revision #66187 with some applications doesn't hook all functions.

Oct 27, 2011 at 3:46 PM

hm..

that's quite big problem.

In my opinion, VLD 2.2 (after #66190) is useless in my application.

my application is quite big, that solution has more than 3M lines, 50 projects roughly,

I can't turn VLD = on for default. my team will never use it due to its slowness. it's too painful.

but VLD 2.1 is good enough for me.

can you give us a option?

I hope VLD is not going to useless for real world.

--------- 원본 메일 ---------
보낸사람: "KindDragon"<notifications@codeplex.com>
받는사람 : hskim70@hanmail.net
날짜: 27 Oct 2011 08:23:11 -0700
제목: Re: VS2010 bug - very slow after revision 66187 [vld:277408]


Coordinator
Nov 2, 2011 at 2:21 PM

I check what I can do.

Nov 7, 2011 at 9:28 PM

I suspect I am running into the same issue. With VLD 2.2, I gave up after wating a half hour for my app's initialization to complete (I could see it VERY slowly progressing). With VLD 2.1, it worked fine.