>CLEAR ALL >CLOSE ALL > >LOCAL m.lcOldSafety >m.lcOldSafety = SET("SAFETY") >SET SAFETY OFF >*Define a single classlib with several layers of inherited classes >*and contrast the performance against several classlibs with >*individual layers of subclasses. > >*Classlib.vcx >*txt1 >*txt11 >*txt111 >*txt1111 > >*versus >*classlib1.vcx >*txt1 > >*classlib11.vcx >*txt11 > >*classlib111.vcx >*txt111 > >*classlib1111.vcx >*txt1111 > >*Create the first txt1 in classlib.vcx > >CREATE CLASSLIB CLASSLIB.VCX > >KEYBOARD "{ctrl+w}" plain >CREATE CLASS txt1 OF classlib.vcx as textbox > >KEYBOARD "{ctrl+w}" plain >CREATE CLASS txt11 OF classlib.vcx as txt1 FROM classlib.vcx > >KEYBOARD "{ctrl+w}" plain >CREATE CLASS txt111 OF classlib.vcx as txt11 FROM classlib.vcx > >KEYBOARD "{ctrl+w}" plain >CREATE CLASS txt1111 OF classlib.vcx as txt111 FROM classlib.vcx > >*Establish a baseline. This exercises VFP's inheritance >*of the init method. >SET CLASSLIB TO classlib.vcx >LOCAL lnSeconds, lnI >lnSeconds=SECONDS() >FOR m.lnI = 1 TO 10000 > lotxtInstance = CREATEOBJECT("txt1") > lotxtInstance = .NULL. >ENDFOR m.lnI >?SECONDS()-m.lnSeconds > >*Now instanciate the lowest level subclass. >SET CLASSLIB TO classlib.vcx >LOCAL lnSeconds, lnI >lnSeconds=SECONDS() >FOR m.lnI = 1 TO 10000 > lotxtInstance = CREATEOBJECT("txt1111") > lotxtInstance = .NULL. >ENDFOR m.lnI >?SECONDS()-m.lnSeconds > >SET CLASSLIB TO > >CREATE CLASSLIB CLASSLIB1.VCX >CREATE CLASSLIB CLASSLIB11.VCX >CREATE CLASSLIB CLASSLIB111.VCX >CREATE CLASSLIB CLASSLIB1111.VCX > >KEYBOARD "{ctrl+w}" plain >CREATE CLASS txt1 OF classlib1.vcx as textbox > >KEYBOARD "{ctrl+w}" plain >CREATE CLASS txt11 OF classlib11.vcx as txt1 FROM classlib1.vcx > >KEYBOARD "{ctrl+w}" plain >CREATE CLASS txt111 OF classlib111.vcx as txt11 FROM classlib11.vcx > >KEYBOARD "{ctrl+w}" plain >CREATE CLASS txt1111 OF classlib1111.vcx as txt111 FROM classlib111.vcx > >*Establish a baseline. This exercises VFP's inheritance >*of the init method. >SET CLASSLIB TO classlib1.vcx >LOCAL lnSeconds, lnI >lnSeconds=SECONDS() >FOR m.lnI = 1 TO 10000 > lotxtInstance = CREATEOBJECT("txt1") > lotxtInstance = .NULL. >ENDFOR m.lnI >?SECONDS()-m.lnSeconds > >*Now instanciate the lowest level subclass. >SET CLASSLIB TO classlib1111.vcx >LOCAL lnSeconds, lnI >lnSeconds=SECONDS() >FOR m.lnI = 1 TO 10000 > lotxtInstance = CREATEOBJECT("txt1111") > lotxtInstance = .NULL. >ENDFOR m.lnI >?SECONDS()-m.lnSeconds > >SET CLASSLIB TO > >SET SAFETY &lcOldSafety >CLEAR ALL >>