On Wed, Aug 09, 2000 at 02:33:36AM -0400, Jim Aston wrote:
>
> I'm profiling Wine with cprof http://opensource.corel.com/cprof.html
> and I am curious as to why lstrlenA has a __TRY, __EXCEPT wrapper
> around a strlen call. The exception handling is 2/3 of the execution time.
> I also noticed that the exception handling isn't used outside the string
> functions. lstrlenA is in the top 20 function calls.
The reason is that some windows apps pass NULL pointers and expect
ERROR_INVALID_PARAMETER to be returned, and not a Dr. Watson pop-up ;)
> So its a tradeoff between speed and stability. Good fodder
> for a discussion, and probably only resolvable by a configure
> option. Before and after output is below...
In theory you can replace all lstrlenA() used in WINE itself by strlen()
if you know that no invalid pointer can be passed.
We could also use a different kind of exceptions for internal functions,
like the zero overhead exceptions used by the Linux Kernel. But these are
architecture dependend and a bit messy to implement.
Ciao, Marcus
> Function Name calls func% func(ms) f+c% f+c(ms)
> WINPROC_CallWndProc 34336 950694057.137 40899241012838 61.644
>2651958
> 1995 950693972.543 40899237373573 100.000
>4302042
> server_call_noerr 279810 93.573 4025559 94.120 4049100
> TryEnterCriticalSection 39993165 2.421 104148 5.724 246233
> CRITSECTION_EnterCriticalSection 36801339 1.984 85331 11.492 494402
> CRITSECTION_LeaveCriticalSection 36801338 1.922 82694 5.577 239904
> __get_teb 119747280 1.855 79819 1.855 79819
Why isn't it inlined?
> EnterCriticalSection 39915277 1.402 60327 7.798 335478
> InterlockedDecrement 40009039 1.341 57704 2.038 87666
Why not inline?
> LeaveCriticalSection 39993164 1.334 57388 3.564 153321
> GetCurrentThreadId 39993177 1.316 56628 1.943 83583
> GetCurrentProcessId 37422520 1.257 54088 3.052 131309
> PROCESS_Current 37954554 1.243 53474 1.823 78409
> InterlockedExchangeAdd 53187500 0.922 39650 0.922 39650
> InterlockedCompareExchange 39993899 0.687 29538 0.687 29538
Why not inline?
> send_request 280074 0.539 23205 0.543 23378
> lstrlenA 8145374 0.451 19381 0.690 29690
Why is it called so often?