Hi~
When I debug code for verifying VBA macros in a spreadsheet document, I
find there are recursive calls in calling stack. Each time when basic code
run to execute a macro step, finally it will send out a broadcast in order
to get a value for a variable. But when basic module response the
broadcast(get Notify), it will trigger another iteration of previous
calling stack. The same stack will be called recursively for many times.
See below stack. I think that is one reason of low performance of VBA code
execution.
So my question is why basic module use such broadcast mechanism to get a
value for a variable? Does such recursive calls work as design or maybe a
mistake? I haven't find VBA design documents in our wikis. So is there any
experienced guys on this area could teach me this?

Clarence

     svl.dll!51e6729b()
     [Frames below may be incorrect and/or missing, no symbols loaded for
svl.dll]
     sb.dll!SbMethod::Broadcast(unsigned long nHintId=65536)  Line 2122 +
0x39 bytes
     sb.dll!SbxValue::SbxValue(const SbxValue & r={...})  Line 274
     sb.dll!SbxVariable::SbxVariable(const SbxVariable & r={...})  Line 91
+ 0x64 bytes
     sb.dll!SbxMethod::SbxMethod(const SbxMethod & r={...})  Line 40 + 0x8f
bytes
     sb.dll!SbiRuntime::FindElement(SbxObject * pObj=0x0561ad10, unsigned
long nOp1=32778, unsigned long nOp2=0, unsigned long nNotFound=87560,
unsigned char bLocal='', unsigned char bStatic=0)  Line 254 + 0x2e
bytes
     sb.dll!SbiRuntime::StepFIND_Impl(SbxObject * pObj=0x0561ad10, unsigned
long nOp1=32778, unsigned long nOp2=0, unsigned long nNotFound=87560,
unsigned char bLocal='', unsigned char bStatic=0)  Line 644 + 0x22
bytes
     sb.dll!SbiRuntime::StepFIND(unsigned long nOp1=32778, unsigned long
nOp2=0)  Line 651
     sb.dll!SbiRuntime::Step()  Line 750
     sb.dll!SbModule::Run(SbMethod * pMeth=0x056a0498)  Line 1157 + 0x8
bytes
>    sb.dll!SbModule::Notify(SfxBroadcaster & rBC={...}, const SfxHint &
rHint={...})  Line 798
     svl.dll!51e6729b()
     sb.dll!SbMethod::Broadcast(unsigned long nHintId=65536)  Line 2122 +
0x39 bytes
     sb.dll!SbxValue::SbxValue(const SbxValue & r={...})  Line 274
     sb.dll!SbxVariable::SbxVariable(const SbxVariable & r={...})  Line 91
+ 0x64 bytes
     sb.dll!SbxMethod::SbxMethod(const SbxMethod & r={...})  Line 40 + 0x8f
bytes
     sb.dll!SbiRuntime::FindElement(SbxObject * pObj=0x09ef3590, unsigned
long nOp1=32911, unsigned long nOp2=0, unsigned long nNotFound=87560,
unsigned char bLocal='', unsigned char bStatic=0)  Line 254 + 0x2e
bytes
     sb.dll!SbiRuntime::StepFIND_Impl(SbxObject * pObj=0x09ef3590, unsigned
long nOp1=32911, unsigned long nOp2=0, unsigned long nNotFound=87560,
unsigned char bLocal='', unsigned char bStatic=0)  Line 644 + 0x22
bytes
     sb.dll!SbiRuntime::StepFIND(unsigned long nOp1=32911, unsigned long
nOp2=0)  Line 651
     sb.dll!SbiRuntime::Step()  Line 750
     sb.dll!SbModule::Run(SbMethod * pMeth=0x09ea0608)  Line 1157 + 0x8
bytes
     sb.dll!SbModule::Notify(SfxBroadcaster & rBC={...}, const SfxHint &
rHint={...})  Line 798
     svl.dll!51e6729b()
     sb.dll!SbMethod::Broadcast(unsigned long nHintId=65536)  Line 2122 +
0x39 bytes
     sb.dll!SbxValue::SbxValue(const SbxValue & r={...})  Line 274
     sb.dll!SbxVariable::SbxVariable(const SbxVariable & r={...})  Line 91
+ 0x64 bytes
     sb.dll!SbxMethod::SbxMethod(const SbxMethod & r={...})  Line 40 + 0x8f
bytes
     sb.dll!SbiRuntime::FindElement(SbxObject * pObj=0x146f5408, unsigned
long nOp1=32783, unsigned long nOp2=0, unsigned long nNotFound=87560,
unsigned char bLocal='', unsigned char bStatic=0)  Line 254 + 0x2e
bytes
     sb.dll!SbiRuntime::StepFIND_Impl(SbxObject * pObj=0x146f5408, unsigned
long nOp1=32783, unsigned long nOp2=0, unsigned long nNotFound=87560,
unsigned char bLocal='', unsigned char bStatic=0)  Line 644 + 0x22
bytes
     sb.dll!SbiRuntime::StepFIND(unsigned long nOp1=32783, unsigned long
nOp2=0)  Line 651
     sb.dll!SbiRuntime::Step()  Line 750
     sb.dll!SbModule::Run(SbMethod * pMeth=0x09f67bd0)  Line 1157 + 0x8
bytes
     sb.dll!SbModule::Notify(SfxBroadcaster & rBC={...}, const SfxHint &
rHint={...})  Line 798
     svl.dll!51e6729b()
     sb.dll!SbMethod::Broadcast(unsigned long nHintId=65536)  Line 2122 +
0x39 bytes
     sb.dll!SbxValue::Get(SbxValues & rRes={...})  Line 531
     sb.dll!SbMethod::Call(SbxValue * pRet=0x0568ff40)  Line 2076
     basprov.uno.dll!basprov::BasicScriptImpl::invoke()  + 0x292 bytes

Reply via email to