mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-29 16:40:25 +02:00
* Some minor stuff
* Managed to eliminate speed effects of string compression
This commit is contained in:
parent
541955ad91
commit
7a6b6f4bd4
@ -869,7 +869,7 @@ end;
|
||||
{ dictionary }
|
||||
Fleft:=nil;
|
||||
Fright:=nil;
|
||||
Fspeedvalue:=cardinal($ffffffff);
|
||||
fspeedvalue:=getspeedvalue(n);
|
||||
{$ifdef compress}
|
||||
FName:=stringdup(minilzw_encode(n));
|
||||
{$else}
|
||||
@ -892,6 +892,7 @@ end;
|
||||
begin
|
||||
if assigned(FName) then
|
||||
stringdispose(FName);
|
||||
fspeedvalue:=getspeedvalue(n);
|
||||
{$ifdef compress}
|
||||
FName:=stringdup(minilzw_encode(n));
|
||||
{$else}
|
||||
@ -1064,7 +1065,7 @@ end;
|
||||
{$ifdef compress}
|
||||
senc:=minilzw_encode(s);
|
||||
{$endif}
|
||||
SpeedValue:=GetSpeedValue(senc);
|
||||
SpeedValue:=GetSpeedValue(s);
|
||||
n:=FRoot;
|
||||
if assigned(FHashArray) then
|
||||
begin
|
||||
@ -1187,7 +1188,7 @@ end;
|
||||
begin
|
||||
hp:=nil;
|
||||
Replace:=false;
|
||||
newobj.FSpeedValue:=GetSpeedValue(newobj.FName^);
|
||||
{ newobj.FSpeedValue:=GetSpeedValue(newobj.FName^);}
|
||||
{ must be the same name and hash }
|
||||
if (oldobj.FSpeedValue<>newobj.FSpeedValue) or
|
||||
(oldobj.FName^<>newobj.FName^) then
|
||||
@ -1255,7 +1256,7 @@ end;
|
||||
|
||||
function Tdictionary.insert(obj:TNamedIndexItem):TNamedIndexItem;
|
||||
begin
|
||||
obj.FSpeedValue:=GetSpeedValue(obj.FName^);
|
||||
{ obj.FSpeedValue:=GetSpeedValue(obj.FName^);}
|
||||
if assigned(FHashArray) then
|
||||
insert:=insertNode(obj,FHashArray^[obj.SpeedValue mod hasharraysize])
|
||||
else
|
||||
@ -1336,7 +1337,7 @@ end;
|
||||
oldsenc:=minilzw_encode(olds);
|
||||
newsenc:=minilzw_encode(news);
|
||||
{$endif}
|
||||
spdval:=GetSpeedValue(oldsenc);
|
||||
spdval:=GetSpeedValue(olds);
|
||||
if assigned(FHashArray) then
|
||||
hp:=FHashArray^[spdval mod hasharraysize]
|
||||
else
|
||||
@ -1389,7 +1390,7 @@ end;
|
||||
hp.FRight:=nil;
|
||||
stringdispose(hp.FName);
|
||||
hp.FName:=stringdup(newsenc);
|
||||
hp.FSpeedValue:=GetSpeedValue(newsenc);
|
||||
hp.FSpeedValue:=GetSpeedValue(news);
|
||||
{ reinsert }
|
||||
if assigned(FHashArray) then
|
||||
rename:=insertNode(hp,FHashArray^[hp.SpeedValue mod hasharraysize])
|
||||
@ -1419,18 +1420,16 @@ end;
|
||||
var t:string;
|
||||
|
||||
begin
|
||||
{$ifdef compress}
|
||||
t:=minilzw_encode(s);
|
||||
search:=speedsearch(t,getspeedvalue(t));
|
||||
{$else}
|
||||
search:=speedsearch(s,getspeedvalue(s));
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
|
||||
function Tdictionary.speedsearch(const s:string;SpeedValue:cardinal):TNamedIndexItem;
|
||||
var
|
||||
NewNode:TNamedIndexItem;
|
||||
{$ifdef compress}
|
||||
decn:string;
|
||||
{$endif}
|
||||
begin
|
||||
if assigned(FHashArray) then
|
||||
NewNode:=FHashArray^[SpeedValue mod hasharraysize]
|
||||
@ -1445,6 +1444,19 @@ end;
|
||||
NewNode:=NewNode.FRight
|
||||
else
|
||||
begin
|
||||
{$ifdef compress}
|
||||
decn:=minilzw_decode(newnode.fname^);
|
||||
if (decn=s) then
|
||||
begin
|
||||
speedsearch:=NewNode;
|
||||
exit;
|
||||
end
|
||||
else
|
||||
if s>decn then
|
||||
NewNode:=NewNode.FLeft
|
||||
else
|
||||
NewNode:=NewNode.FRight;
|
||||
{$else}
|
||||
if (NewNode.FName^=s) then
|
||||
begin
|
||||
speedsearch:=NewNode;
|
||||
@ -1455,6 +1467,7 @@ end;
|
||||
NewNode:=NewNode.FLeft
|
||||
else
|
||||
NewNode:=NewNode.FRight;
|
||||
{$endif}
|
||||
end;
|
||||
end;
|
||||
speedsearch:=nil;
|
||||
@ -1943,7 +1956,11 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.29 2004-01-11 23:56:19 daniel
|
||||
Revision 1.30 2004-01-15 15:16:17 daniel
|
||||
* Some minor stuff
|
||||
* Managed to eliminate speed effects of string compression
|
||||
|
||||
Revision 1.29 2004/01/11 23:56:19 daniel
|
||||
* Experiment: Compress strings to save memory
|
||||
Did not save a single byte of mem; clearly the core size is boosted by
|
||||
temporary memory usage...
|
||||
|
@ -767,8 +767,6 @@ uses
|
||||
i : integer;
|
||||
InitCrc : cardinal;
|
||||
begin
|
||||
if Crc32Tbl[1]=0 then
|
||||
MakeCrc32Tbl;
|
||||
InitCrc:=cardinal($ffffffff);
|
||||
for i:=1 to Length(s) do
|
||||
InitCrc:=Crc32Tbl[byte(InitCrc) xor ord(s[i])] xor (InitCrc shr 8);
|
||||
@ -979,11 +977,16 @@ uses
|
||||
end;
|
||||
|
||||
initialization
|
||||
makecrc32tbl;
|
||||
initupperlower;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.30 2004-01-11 23:56:19 daniel
|
||||
Revision 1.31 2004-01-15 15:16:18 daniel
|
||||
* Some minor stuff
|
||||
* Managed to eliminate speed effects of string compression
|
||||
|
||||
Revision 1.30 2004/01/11 23:56:19 daniel
|
||||
* Experiment: Compress strings to save memory
|
||||
Did not save a single byte of mem; clearly the core size is boosted by
|
||||
temporary memory usage...
|
||||
|
@ -1324,11 +1324,7 @@ type
|
||||
begin
|
||||
if srsymtable.symtabletype in [localsymtable,staticsymtable,globalsymtable] then
|
||||
begin
|
||||
{$ifdef compress}
|
||||
srprocsym:=tprocsym(srsymtable.speedsearch(minilzw_encode(symtableprocentry.name),symtableprocentry.speedvalue));
|
||||
{$else}
|
||||
srprocsym:=tprocsym(srsymtable.speedsearch(minilzw_encode(symtableprocentry.name),symtableprocentry.speedvalue));
|
||||
{$endif}
|
||||
srprocsym:=tprocsym(srsymtable.speedsearch(symtableprocentry.name,symtableprocentry.speedvalue));
|
||||
{ process only visible procsyms }
|
||||
if assigned(srprocsym) and
|
||||
(srprocsym.typ=procsym) and
|
||||
@ -2715,7 +2711,11 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.219 2004-01-14 17:53:58 peter
|
||||
Revision 1.220 2004-01-15 15:16:18 daniel
|
||||
* Some minor stuff
|
||||
* Managed to eliminate speed effects of string compression
|
||||
|
||||
Revision 1.219 2004/01/14 17:53:58 peter
|
||||
* ignore hidden parameters when default parameters are used
|
||||
|
||||
Revision 1.218 2004/01/11 23:56:19 daniel
|
||||
|
@ -284,15 +284,8 @@ implementation
|
||||
|
||||
function tsymtable.search(const s : stringid) : tsymentry;
|
||||
|
||||
var senc:string;
|
||||
|
||||
begin
|
||||
{$ifdef compress}
|
||||
senc:=minilzw_encode(s);
|
||||
search:=speedsearch(senc,getspeedvalue(senc));
|
||||
{$else}
|
||||
search:=speedsearch(s,getspeedvalue(s));
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
|
||||
@ -341,7 +334,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.17 2004-01-11 23:56:20 daniel
|
||||
Revision 1.18 2004-01-15 15:16:18 daniel
|
||||
* Some minor stuff
|
||||
* Managed to eliminate speed effects of string compression
|
||||
|
||||
Revision 1.17 2004/01/11 23:56:20 daniel
|
||||
* Experiment: Compress strings to save memory
|
||||
Did not save a single byte of mem; clearly the core size is boosted by
|
||||
temporary memory usage...
|
||||
|
@ -4137,6 +4137,7 @@ implementation
|
||||
end;
|
||||
|
||||
procedure tprocdef.concatstabto(asmlist : taasmoutput);
|
||||
|
||||
begin
|
||||
{ released procdef? }
|
||||
if not assigned(parast) then
|
||||
@ -6163,7 +6164,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.198 2004-01-11 23:56:20 daniel
|
||||
Revision 1.199 2004-01-15 15:16:18 daniel
|
||||
* Some minor stuff
|
||||
* Managed to eliminate speed effects of string compression
|
||||
|
||||
Revision 1.198 2004/01/11 23:56:20 daniel
|
||||
* Experiment: Compress strings to save memory
|
||||
Did not save a single byte of mem; clearly the core size is boosted by
|
||||
temporary memory usage...
|
||||
|
@ -1793,20 +1793,12 @@ implementation
|
||||
function searchsym(const s : stringid;var srsym:tsym;var srsymtable:tsymtable):boolean;
|
||||
var
|
||||
speedvalue : cardinal;
|
||||
{$ifdef compress}
|
||||
senc:stringid;
|
||||
{$else}
|
||||
senc:stringid absolute s;
|
||||
{$endif}
|
||||
begin
|
||||
{$ifdef compress}
|
||||
senc:=minilzw_encode(s);
|
||||
{$endif}
|
||||
speedvalue:=getspeedvalue(senc);
|
||||
speedvalue:=getspeedvalue(s);
|
||||
srsymtable:=symtablestack;
|
||||
while assigned(srsymtable) do
|
||||
begin
|
||||
srsym:=tsym(srsymtable.speedsearch(senc,speedvalue));
|
||||
srsym:=tsym(srsymtable.speedsearch(s,speedvalue));
|
||||
if assigned(srsym) and
|
||||
(not assigned(current_procinfo) or
|
||||
tstoredsym(srsym).is_visible_for_object(current_procinfo.procdef._class)) then
|
||||
@ -1824,16 +1816,8 @@ implementation
|
||||
function searchsym_type(const s : stringid;var srsym:tsym;var srsymtable:tsymtable):boolean;
|
||||
var
|
||||
speedvalue : cardinal;
|
||||
{$ifdef compress}
|
||||
senc:stringid;
|
||||
{$else}
|
||||
senc:stringid absolute s;
|
||||
{$endif}
|
||||
begin
|
||||
{$ifdef compress}
|
||||
senc:=minilzw_encode(s);
|
||||
{$endif}
|
||||
speedvalue:=getspeedvalue(senc);
|
||||
speedvalue:=getspeedvalue(s);
|
||||
srsymtable:=symtablestack;
|
||||
while assigned(srsymtable) do
|
||||
begin
|
||||
@ -1845,7 +1829,7 @@ implementation
|
||||
}
|
||||
if not(srsymtable.symtabletype in [recordsymtable,objectsymtable,parasymtable]) then
|
||||
begin
|
||||
srsym:=tsym(srsymtable.speedsearch(senc,speedvalue));
|
||||
srsym:=tsym(srsymtable.speedsearch(s,speedvalue));
|
||||
if assigned(srsym) and
|
||||
(not assigned(current_procinfo) or
|
||||
tstoredsym(srsym).is_visible_for_object(current_procinfo.procdef._class)) then
|
||||
@ -1893,16 +1877,8 @@ implementation
|
||||
speedvalue : cardinal;
|
||||
topclassh : tobjectdef;
|
||||
sym : tsym;
|
||||
{$ifdef compress}
|
||||
senc:stringid;
|
||||
{$else}
|
||||
senc:stringid absolute s;
|
||||
{$endif}
|
||||
begin
|
||||
{$ifdef compress}
|
||||
senc:=minilzw_encode(s);
|
||||
{$endif}
|
||||
speedvalue:=getspeedvalue(senc);
|
||||
speedvalue:=getspeedvalue(s);
|
||||
{ when the class passed is defined in this unit we
|
||||
need to use the scope of that class. This is a trick
|
||||
that can be used to access protected members in other
|
||||
@ -1921,7 +1897,7 @@ implementation
|
||||
sym:=nil;
|
||||
while assigned(classh) do
|
||||
begin
|
||||
sym:=tsym(classh.symtable.speedsearch(senc,speedvalue));
|
||||
sym:=tsym(classh.symtable.speedsearch(s,speedvalue));
|
||||
if assigned(sym) and
|
||||
tstoredsym(sym).is_visible_for_object(topclassh) then
|
||||
break;
|
||||
@ -2067,19 +2043,11 @@ implementation
|
||||
var
|
||||
speedvalue : cardinal;
|
||||
srsym : tsym;
|
||||
{$ifdef compress}
|
||||
senc:string;
|
||||
{$else}
|
||||
senc:string absolute s;
|
||||
{$endif}
|
||||
begin
|
||||
{$ifdef compress}
|
||||
senc:=minilzw_encode(s);
|
||||
{$endif}
|
||||
speedvalue:=getspeedvalue(senc);
|
||||
speedvalue:=getspeedvalue(s);
|
||||
while assigned(pd) do
|
||||
begin
|
||||
srsym:=tsym(pd.symtable.speedsearch(senc,speedvalue));
|
||||
srsym:=tsym(pd.symtable.speedsearch(s,speedvalue));
|
||||
if assigned(srsym) then
|
||||
begin
|
||||
search_class_member:=srsym;
|
||||
@ -2140,7 +2108,7 @@ implementation
|
||||
var
|
||||
speedvalue : cardinal;
|
||||
srsym : tprocsym;
|
||||
senc : string;
|
||||
s : string;
|
||||
objdef : tobjectdef;
|
||||
begin
|
||||
if aprocsym.overloadchecked then
|
||||
@ -2153,15 +2121,11 @@ implementation
|
||||
if not assigned(objdef.childof) then
|
||||
exit;
|
||||
objdef:=objdef.childof;
|
||||
{$ifdef compress}
|
||||
senc:=minilzw_encode(aprocsym.name);
|
||||
{$else}
|
||||
senc:=aprocsym.name;
|
||||
{$endif}
|
||||
speedvalue:=getspeedvalue(senc);
|
||||
s:=aprocsym.name;
|
||||
speedvalue:=getspeedvalue(s);
|
||||
while assigned(objdef) do
|
||||
begin
|
||||
srsym:=tprocsym(objdef.symtable.speedsearch(senc,speedvalue));
|
||||
srsym:=tprocsym(objdef.symtable.speedsearch(s,speedvalue));
|
||||
if assigned(srsym) then
|
||||
begin
|
||||
if (srsym.typ<>procsym) then
|
||||
@ -2334,7 +2298,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.124 2004-01-11 23:56:20 daniel
|
||||
Revision 1.125 2004-01-15 15:16:18 daniel
|
||||
* Some minor stuff
|
||||
* Managed to eliminate speed effects of string compression
|
||||
|
||||
Revision 1.124 2004/01/11 23:56:20 daniel
|
||||
* Experiment: Compress strings to save memory
|
||||
Did not save a single byte of mem; clearly the core size is boosted by
|
||||
temporary memory usage...
|
||||
|
Loading…
Reference in New Issue
Block a user