Differences From Artifact [c2e4810a49]:
- File
src/natools-smaz_generic.adb
— part of check-in
[674fadc74b]
at
2016-12-16 20:55:19
on branch trunk
— smaz_generic: optimize compression
For some reason it seems even with -O3, calling Dict_Entry involves a string copy, which makes `memcpy` the larger time consumer of the copmpression algorithm. Inlining it manually improves performance a lot. (user: nat size: 8566)
To Artifact [f4b07b4eb0]:
- File src/natools-smaz_generic.adb — part of check-in [b9f0155723] at 2017-02-25 20:45:22 on branch trunk — smaz_generic: update semantics of Read_Code to signal end-of-input (user: nat size: 8675)
| ︙ | |||
196 197 198 199 200 201 202 203 204 205 206 207 208 209 | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | + |
Code, Verbatim_Length,
Dict.Last_Code, Dict.Variable_Length_Verbatim);
if Verbatim_Length > 0 then
Skip_Verbatim (Input, Input_Index, Verbatim_Length);
Result := Result + Verbatim_Length;
else
exit when not Is_Valid_Code (Dict, Code);
Result := Result + Dict_Entry_Length (Dict, Code);
end if;
end loop;
return Result;
end Decompressed_Length;
|
| ︙ | |||
229 230 231 232 233 234 235 236 237 238 239 240 241 242 | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | + + |
if Verbatim_Length > 0 then
Read_Verbatim
(Input, Input_Index,
Output_Buffer
(Output_Last + 1 .. Output_Last + Verbatim_Length));
Output_Last := Output_Last + Verbatim_Length;
else
exit when not Is_Valid_Code (Dict, Code);
declare
Decoded : constant String := Dict_Entry (Dict, Code);
begin
Output_Buffer (Output_Last + 1 .. Output_Last + Decoded'Length)
:= Decoded;
Output_Last := Output_Last + Decoded'Length;
end;
|
| ︙ |