Natools

Check-in [674fadc74b]
Login
Overview
Comment: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.

Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 674fadc74b1d6f25dc5e0b6f047e3cfef43e3155
User & Date: nat on 2016-12-16 20:55:19
Other Links: manifest | tags
Context
2016-12-17
22:48
tools/smaz: add a roundtrip check option to help debug new code check-in: f44feb5e3e user: nat tags: trunk
2016-12-16
20:55
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. check-in: 674fadc74b user: nat tags: trunk

2016-12-15
20:12
tools/smaz: use the new validation function instead of ad-hoc code check-in: 3a95d52c86 user: nat tags: trunk
Changes

Modified src/natools-smaz_generic.adb from [328ba1ead5] to [c2e4810a49].

61
62
63
64
65
66
67
68


69
70
71
72
73
74
75
               Is_Valid := True;
            end if;
         exception
            when Constraint_Error => null;
         end To_Code;

         if Is_Valid
           and then Dict_Entry (Dict, Code) = Template (Template'First .. Last)


         then
            Length := 1 + Last - Template'First;
            return;
         end if;
      end loop;
   end Find_Entry;








|
>
>







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
               Is_Valid := True;
            end if;
         exception
            when Constraint_Error => null;
         end To_Code;

         if Is_Valid
           and then Template (Template'First .. Last)
              = Dict.Values (Code_First (Dict.Offsets, Code, Dict.Values'First)
                          .. Code_Last (Dict.Offsets, Code, Dict.Values'Last))
         then
            Length := 1 + Last - Template'First;
            return;
         end if;
      end loop;
   end Find_Entry;