Delphi Copyº¯ÊýЧÂʵÄÎÊÌâ
¼¼Êõ½»Á÷,DH½²½â. ×î½üºÍ·ÊÄñ½»Á÷ÁËϹØÓÚ×Ö·û´®·½ÃæµÄ֪ʶ,¶øÕâƪÎÄÕÂÊǺܾÃÒÔǰдµÄ,ÏÖÔÚ·¢³öÀ´°É. ÎÒÃÇдÁ½¶Î´úÂëÀ´¶Ô±ÈÏÂ:
µÚÒ»¸öÓÃCopyº¯Êý:
procedure TForm1.Button1Click(Sender: TObject);
var
a,c:Cardinal;
n:Integer;
D:Double;
i:Integer;
b:string;
begin
c:=0;
for n:=0 to 99 do
begin
a:=GetTickCount;
for i:=0 to 999999 do
begin
b:=Copy(s,1,20);
end;
a:=GetTickCount-a;
C:=C+A;
end;
D:=C/100;
Label1.Caption:=FloatToStr(D);
end;
µÚ¶þ¸öÓÃMoveMemoryº¯Êý:
procedure TForm1.Button2Click(Sender: TObject);
var
a,c:Cardinal;
n:Integer;
d:Double;
i:Integer;
b:string;
begin
c:=0;
for n:=0 to 99 do
begin
a:=GetTickCount;
for i:=0 to 999999 do
begin
SetLength(b,20);
MoveMemory(@b[1],@s[1],20);
end;
a:=GetTickCount-a;
C:=C+A;
end;
D:=C/100;
Label2.Caption:=FloatToStr(D);
end;
ÆäÖÐ:
procedure TForm1.FormCreate(Sender: TObject);
begin
s:='HuangJackyJackyHuang';
end;
¿´ÏÂʵÑéÊý¾Ý:
1ÓÃÁË 264
2ÓÃÁË 169
µ±È»ÕâÊÇÔÚÔËÐÐÁË9999900´Î²Å¿´³öÀ´µÄ,Èç¹ûÎÒÃÇ°Ñs¸³Öµ³ÉÒ»¸öºÜ³¤µÄ×Ö·û´®¿´¿´
µ±×Ö·û´®sÓÐ100¸ö×Ö·û,Copy 100¸ö:
1ÓÃÁË266
2ÓÃÁË181
¼ÌÐø SÓÐ200¸ö×Ö·û,Copy 200¸öµÄÇé¿ö
1 244
2 186
¿ÉÒÔ¿´³öÀ´ÔÚ¶Ì×Ö·û´®µÄÇé¿öÏÂMoveMemory¿Ï¶¨Òª¿ìһЩ,ºóÃæ×Ö·û´®Ôö³¤CopyЧÂÊûÓÐϽµ,
µ«ÊÇSetLength + MoveMemory¾ÍϽµÁË
×îºósÓÐ400¸ö×Ö·ûCopy 400¸ö,µ«ÊÇÎÒ°ÑSetLength·ÅÔÚÑ»·ÍâÃæÁË,Ò²¾ÍÊÇÖ»SetLengthÒ»´Î,Ò²¾ÍÖ»±È½ÏCopyºÍMoveMemoryÕâÁ½¸öÁË.
1 216
2 89
¹þ¹þ½ñÌì»»ÔŲ́ʽ»úÁË,ËùÒÔ2¸öÔËÐÐʱ¼ä¶¼¼õÉÙÁ˺ܶà.
ÔÙ²âÊÔÏÂSetLengthÔÚÑ»·ÌåÀïÃæµÄÇé¿ö ÓÃÁË147.
ÕâÏÂ×ÓÎÒÃÇ¿ÉÒÔ¿´³öÀ´Ò»¸öSetLengthºÄÁ˶àÉÙ×ÊÔ´.
OK,ÎÒÃÇ¿´¼ûÁËÕâ¸ö½á¹û,¿ÉÊÇΪʲô»áÕâÑùÄØ?ÓÐÅóÓÑÏëÁ˽âûÓÐ?
ÒªÁ˽â¾ÍÒªÉîÈ뺯ÊýÄÚ²¿È¥:
ÎÒÃÇÏÈ¿´1µÄÇé¿ö:
Unit1.p
Ïà¹ØÎĵµ£º
×î½ü×öÒ»¸öÏîÄ¿£¬ÒªÓÃDelphi£¬ÒÔÇ°´Óδѧ¹ý£¬ºÃÊǷѾ¢°¡£¬¹þ¹þ¹âÊÇ×Ö·û´®ÇиîÕâ¸öÎÊÌâ¾ÍÀ§ÈÅÁ˼¸¸öСʱ£¬Í¨¹ý²é×ÊÁÏÖÕÓÚ½â¾ö£¬ÔÚÕâÓë´ó¼Ò·ÖÏíÒ»ÏÂ
Function split(src: pchar; ch: char):TStringList;
// ·Ö¸î×Ö·û´®
var
i: Integer;
tmp : string;
begin
Result:=TStringList.Create;
......
·½·¨Ò»£º
Ö±½Óµ¯³öUDL¶Ô»°¿ò:
use
ADOConed;
EditConnectionString(ADOQuery1);
·½·¨¶þ£º
¢Å¡¢ÓÒ¼ü---н¨---Îı¾Îĵµ£¬ÖØÃüÃûΪ connSet.udl ¡£
¢Æ¡¢Ë«»÷´ò¿ª connSet.udl °´Ìáʾ²Ù×÷ÅäÖÃÊý¾Ý¿â£¬Ñ¡Ôñ±¾µØ»òÔ¶³ÌÊý¾Ý¿â£¬ÅäÖúúóÍ˳ö¡£
¢Ç¡¢Ê¹ÓÃDelphi ¿Ø¼þTADOConnectionÁ¬½Ó´úÂ룺
ÔÚForm ......
Ò»¡¢¸ÅÊö¼°Ê¾Àý´úÂë
DelphiÖаüÀ¨Ðí¶àÒѾ·â×°ºÃµÄÀ༰¿Ø¼þ£¬ÆäÖеķǿÉÊÓ»¯¿Ø¼þ¿âÒÔ¹¦ÄÜ·½Ê½»®·Ö¿É´¦ÀíÖî¶àÓ¦ÓÃÐèÇó¡£ÈôʹÓÃC£«£«ÊµÏÖϵͳʱ¶ÔijЩ¹¦Äܼòµ¥µ÷ÓÃdelphiÖÐÏֳɵĿâʱ¼´¿É¡£Òò´Ë½«delphiÖеĿâÒÔDLLÐÎʽ·â×°ºÃÖ®ºóÈçºÎ½«·½·¨µ¼³ö¿É¹©C£«£«µ÷ÓÃÊDZ¾ÎļǼµÄÖص㡣C£«£«µ÷Óõķ½Ê½ÓжàÖÖ£¬ÔÚÕâÀïÖ»ÌÖÂÛÒ»ÖÖ¾² ......
ÓÃDelphi×÷µÄ³ÌÐòµÄÔ´´úÂëÖг£¼ûµÄÎļþÀ©Õ¹Ãû£¬²¢¸ø³öÁËÕâЩÎļþÀ©Õ¹ÃûµÄÒâÒ壬ÒÔ±ãÔ´´úÂë¹ÜÀíʱ×÷Ϊ²ÎÕÕ£¬À©Õ¹ÃûÒÔ×ÖĸΪÐò£¨²»ÐèÒª½øÔ´´úÂë¿â²»±íʾ²»ÐèÒª½ø¿â£©¡£
¡¡¡¡~*
¡¡¡¡DelphiÉú³ÉµÄ±¸·ÝÎļþ£¬ÔÚ°æ±¾¿ØÖÆ¿â¼°·¢²¼´úÂëÖв»Ó¦¸Ã³öÏÖÕâЩÎļþ£¬Èç¹ûÐÞ¸ÄÁËij¸öÎļþÈ´ÒòijЩÔÒòûÓб£´æµÄ»°£¬¿ÉÒÔ³¢ÊÔʹÓÃÕâЩÎļþ» ......
1¡¢ ϵͳ¹¦ÄÜ
1£©¡¢Êý¾ÝѹËõ
ʹÓÃDELPHIÌṩµÄÁ½¸öÁ÷ÀࣨTCompressionStreamºÍTDecompressionStream£©À´Íê³ÉÊý¾ÝµÄѹËõºÍ½âѹËõ¡£
2£©¡¢Êý¾Ý¼ÓÃÜѹËõ
ͨ¹ýDelphi±à³ÌÖГÁ÷”µÄÓ¦ÓÃʵÏÖÊý¾Ý¼ÓÃÜ£¬Ö÷Òª²ÉÓÃTstreamµÄÁ½¸öÅÉÉúÀàTfilestream¡¢Tmemorystream À´Íê³ÉµÄ£»ÆäÖÐÊý¾ÝѹËõ²¿·Ö²ÉÓÃ1£©µÄʵÏÖ· ......