Leigh I'm interested, was it more optimal, as a programmer that started in Z80 assembler we always tried to minimise any constant values in code (as they took a byte), 0 is not to bad it doesn't require a load, but
fMyRecord.fLength := 23; fMyRecord.fCount := 23; fMyRecord.fReadOnly := False; would be quite awful N ----- Original Message ----- From: "Leigh Wanstead" <[EMAIL PROTECTED]> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> Sent: Tuesday, June 17, 2003 2:23 PM Subject: RE: [DUG]: Delphi optimizer > Dear Neven, > > Thanks > > It works as expected. > > Best Regards > Leigh > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Behalf Of Neven MacEwan > Sent: Tuesday, June 17, 2003 1:39 PM > To: Multiple recipients of list delphi > Subject: Re: [DUG]: Delphi optimizer > > > Leigh > > Had a chuckle at Dennis's post :-) > > If you are trying to optimise code you could try compiling > > fMyRecord.fLength := 0; > fMyRecord.fCount := fMyRecord.fLength; > fMyRecord.fReadOnly := False; > > Neven > > > ----- Original Message ----- > From: "Leigh Wanstead" <[EMAIL PROTECTED]> > To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> > Sent: Tuesday, June 17, 2003 11:43 AM > Subject: [DUG]: Delphi optimizer > > > > Hello everyone, > > > > I was surprised that Delphi 7 generate following asmbler code for this > > pascal code. I have turned on Code generation/Optimization. > > > > fMyRecord.fLength := 0; > > fMyRecord.fCount := 0; > > fMyRecord.fReadOnly := False; > > > > xor edx, edx > > mov [eax+$2fc], edx > > > > xor edx, edx > > mov [eax+$300], edx > > > > mov byte ptr [eax+$304], $0 > > > > I think the optimized asm code will look like this. > > > > xor edx, edx > > mov [eax+$2fc], edx > > mov [eax+$300], edx > > mov [eax+$304], edx > > > > I tested the hand written asm code, it is 5 cpu clock cycle faster. I hate > > to put asm in my source code. So the question is how to write delphi code > to > > generate optimize asm code like this one. > > > > I know this slow down may not sound that much, just for research purpose. > > > > I have enclosed delphi sample code for your reference. I look forward to > > hearing from you. > > > > TIA > > > > Best Regards > > Leigh > > > > -------------------------------------------------------------------------- - > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > Website: http://www.delphi.org.nz > To UnSub, send email to: [EMAIL PROTECTED] > with body of "unsubscribe delphi" > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > > > -------------------------------------------------------------------------- - > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > Website: http://www.delphi.org.nz > To UnSub, send email to: [EMAIL PROTECTED] > with body of "unsubscribe delphi" > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > > --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
