Permalink
Commits on Jan 24, 2017
  1. Introduce Entry internal object

    weppos committed Jan 24, 2017
    Better distinguish between a Rule (public API) and an Entry (internal
    API).
  2. Restructure Rule initialization

    weppos committed Jan 24, 2017
    .new now takes all parameters, as you would create a completely new
    instance when you have the data.
    
    A new method called .build is used to create a new Rule from a rule
    content.
  3. Allocation comparison with master is way lowe

    weppos committed Jan 24, 2017
    Using the new benchmarks introduced in dec53e6,
    the allocation is clearly lower even during execution time.
    
        ➜  publicsuffix-ruby git:(master) ✗ ruby test/profilers/find_profiler.rb
        Total allocated: 31472 bytes (691 objects)
        Total retained:  0 bytes (0 objects)
    
        ➜  publicsuffix-ruby git:(master) ✗ ruby test/profilers/domain_profiler.rb
        Total allocated: 37410 bytes (744 objects)
        Total retained:  0 bytes (0 objects)
    
    vs
    
        ➜  publicsuffix-ruby git:(thesis-hash) ruby test/profilers/find_profiler.rb
        Total allocated: 1264 bytes (22 objects)
        Total retained:  0 bytes (0 objects)
    
        ➜  publicsuffix-ruby git:(thesis-hash) ruby test/profilers/domain_profiler.rb
        Total allocated: 7202 bytes (75 objects)
        Total retained:  0 bytes (0 objects)
  4. Optimize space by removing duplicate rule value

    weppos committed Jan 24, 2017
    When the rule is stored, we can remove the value from the Rule as
    the value if effectively the key of the Hash.
    
        ➜  publicsuffix-ruby git:(before) ruby test/profilers/initialization_profiler.rb
        Total allocated: 5882690 bytes (52219 objects)
        Total retained:  1375819 bytes (24188 objects)
    
        ➜  publicsuffix-ruby git:(before) ruby test/profilers/execution_profiler.rb
        Total allocated: 15170 bytes (160 objects)
        Total retained:  0 bytes (0 objects)
    
        ➜  publicsuffix-ruby git:(after) ✗ ruby test/profilers/initialization_profiler.rb
        Total allocated: 6205130 bytes (60280 objects)
        Total retained:  1052404 bytes (16127 objects)
    
        ➜  publicsuffix-ruby git:(after) ✗ ruby test/profilers/execution_profiler.rb
        Total allocated: 15330 bytes (164 objects)
        Total retained:  0 bytes (0 objects)
    
    compared to master
    
        ➜  publicsuffix-ruby git:(master) ruby test/profilers/initialization_profiler.rb
        Total allocated: 6525758 bytes (72086 objects)
        Total retained:  1020387 bytes (19234 objects)
    
        ➜  publicsuffix-ruby git:(master) ruby test/profilers/execution_profiler.rb
        Total allocated: 204162 bytes (4420 objects)
        Total retained:  0 bytes (0 objects)
    
    Execution time is unchanged.
    
        ➜  publicsuffix-ruby git:(before) ruby test/benchmarks/bm_find.rb
    
                                       user     system      total        real
        NAME_SHORT                  0.260000   0.000000   0.260000 (  0.262684)
        NAME_SHORT (noprivate)      0.370000   0.010000   0.380000 (  0.372534)
        NAME_MEDIUM                 0.330000   0.000000   0.330000 (  0.335683)
        NAME_MEDIUM (noprivate)     0.490000   0.000000   0.490000 (  0.494590)
        NAME_LONG                   0.510000   0.010000   0.520000 (  0.519750)
        NAME_LONG (noprivate)       0.590000   0.000000   0.590000 (  0.594626)
        NAME_WILD                   0.480000   0.000000   0.480000 (  0.490432)
        NAME_WILD (noprivate)       0.580000   0.010000   0.590000 (  0.594776)
        NAME_EXCP                   0.460000   0.000000   0.460000 (  0.470119)
        NAME_EXCP (noprivate)       0.590000   0.010000   0.600000 (  0.601316)
        IAAA                        0.300000   0.000000   0.300000 (  0.305301)
        IAAA (noprivate)            0.400000   0.000000   0.400000 (  0.410586)
        IZZZ                        0.280000   0.000000   0.280000 (  0.283711)
        IZZZ (noprivate)            0.400000   0.010000   0.410000 (  0.408137)
        PAAA                        0.490000   0.000000   0.490000 (  0.501869)
        PAAA (noprivate)            0.600000   0.000000   0.600000 (  0.612187)
        PZZZ                        0.510000   0.010000   0.520000 (  0.519206)
        PZZZ (noprivate)            0.590000   0.000000   0.590000 (  0.600264)
        JP                          0.390000   0.000000   0.390000 (  0.404432)
        JP (noprivate)              0.540000   0.010000   0.550000 (  0.558351)
        IT                          0.290000   0.000000   0.290000 (  0.298931)
        IT (noprivate)              0.410000   0.000000   0.410000 (  0.420742)
        COM                         0.290000   0.010000   0.300000 (  0.300935)
        COM (noprivate)             0.400000   0.000000   0.400000 (  0.409309)
    
        ➜  publicsuffix-ruby git:(after) ✗ ruby test/benchmarks/bm_find.rb
    
                                       user     system      total        real
        NAME_SHORT                  0.320000   0.000000   0.320000 (  0.320201)
        NAME_SHORT (noprivate)      0.430000   0.000000   0.430000 (  0.443678)
        NAME_MEDIUM                 0.380000   0.000000   0.380000 (  0.388169)
        NAME_MEDIUM (noprivate)     0.490000   0.010000   0.500000 (  0.491073)
        NAME_LONG                   0.480000   0.000000   0.480000 (  0.483376)
        NAME_LONG (noprivate)       0.620000   0.010000   0.630000 (  0.634896)
        NAME_WILD                   0.570000   0.020000   0.590000 (  0.628489)
        NAME_WILD (noprivate)       0.700000   0.030000   0.730000 (  0.769070)
        NAME_EXCP                   0.580000   0.020000   0.600000 (  0.618683)
        NAME_EXCP (noprivate)       0.740000   0.030000   0.770000 (  0.799244)
        IAAA                        0.410000   0.030000   0.440000 (  0.474761)
        IAAA (noprivate)            0.550000   0.040000   0.590000 (  0.645329)
        IZZZ                        0.380000   0.020000   0.400000 (  0.432898)
        IZZZ (noprivate)            0.520000   0.020000   0.540000 (  0.579073)
        PAAA                        0.680000   0.040000   0.720000 (  0.760276)
        PAAA (noprivate)            0.720000   0.020000   0.740000 (  0.773864)
        PZZZ                        0.700000   0.040000   0.740000 (  0.782113)
        PZZZ (noprivate)            0.650000   0.010000   0.660000 (  0.664647)
        JP                          0.470000   0.000000   0.470000 (  0.478473)
        JP (noprivate)              0.580000   0.010000   0.590000 (  0.589827)
        IT                          0.360000   0.000000   0.360000 (  0.379309)
        IT (noprivate)              0.450000   0.010000   0.460000 (  0.471794)
        COM                         0.330000   0.010000   0.340000 (  0.334253)
        COM (noprivate)             0.530000   0.030000   0.560000 (  0.592813)
  5. Naive index vs Hash benchmarks (profilers)

    weppos committed Jan 23, 2017
    Using the naive indexing:
    
        ➜  publicsuffix-ruby git:(master) ruby test/profilers/execution_profiler.rb
        Total allocated: 204162 bytes (4420 objects)
        Total retained:  0 bytes (0 objects)
    
        allocated memory by gem
        -----------------------------------
            204002  publicsuffix-ruby/lib
               160  other
    
        allocated memory by class
        -----------------------------------
            177036  String
             18416  Array
              2560  Hash
              2134  Regexp
              1168  RubyVM::Env
              1120  MatchData
               800  Proc
               576  Enumerator::Lazy
                96  Enumerator::Generator
                96  Enumerator::Yielder
                80  PublicSuffix::Domain
                80  PublicSuffix::Rule::Wildcard
    
        allocated objects by gem
        -----------------------------------
              4416  publicsuffix-ruby/lib
                 4  other
    
        allocated objects by class
        -----------------------------------
              4332  String
                32  Array
                16  Hash
                10  Proc
                10  RubyVM::Env
                 4  Enumerator::Lazy
                 4  MatchData
                 4  Regexp
                 2  Enumerator::Generator
                 2  Enumerator::Yielder
                 2  PublicSuffix::Domain
                 2  PublicSuffix::Rule::Wildcard
    
        retained memory by gem
        -----------------------------------
        NO DATA
    
        retained memory by file
        -----------------------------------
        NO DATA
    
        retained memory by location
        -----------------------------------
        NO DATA
    
        retained memory by class
        -----------------------------------
        NO DATA
    
        retained objects by gem
        -----------------------------------
        NO DATA
    
        retained objects by file
        -----------------------------------
        NO DATA
    
        retained objects by location
        -----------------------------------
        NO DATA
    
        retained objects by class
        -----------------------------------
        NO DATA
    
    Using Hash:
    
        ➜  publicsuffix-ruby git:(thesis-hash) ruby test/profilers/execution_profiler.rb
        Total allocated: 15170 bytes (160 objects)
        Total retained:  0 bytes (0 objects)
    
        allocated memory by gem
        -----------------------------------
             15010  publicsuffix-ruby/lib
               160  other
    
        allocated memory by class
        -----------------------------------
              8076  String
              2560  Hash
              2134  Regexp
              1120  Array
              1120  MatchData
                80  PublicSuffix::Domain
                80  PublicSuffix::Rule::Wildcard
    
        allocated objects by gem
        -----------------------------------
               156  publicsuffix-ruby/lib
                 4  other
    
        allocated objects by class
        -----------------------------------
               108  String
                24  Array
                16  Hash
                 4  MatchData
                 4  Regexp
                 2  PublicSuffix::Domain
                 2  PublicSuffix::Rule::Wildcard
    
        retained memory by gem
        -----------------------------------
        NO DATA
    
        retained memory by file
        -----------------------------------
        NO DATA
    
        retained memory by location
        -----------------------------------
        NO DATA
    
        retained memory by class
        -----------------------------------
        NO DATA
    
        retained objects by gem
        -----------------------------------
        NO DATA
    
        retained objects by file
        -----------------------------------
        NO DATA
    
        retained objects by location
        -----------------------------------
        NO DATA
    
        retained objects by class
        -----------------------------------
        NO DATA
  6. Naive index vs Hash benchmarks (benchmarks)

    weppos committed Jan 23, 2017
    After I finally realize why the benchmarks were still using
    the old code, and fixing the issue in 5ed8d00, here's the new
    benchmarks that compare the existing implementation with the new
    lookup based on Hash.
    
    Using the naive indexing:
    
        ➜  publicsuffix-ruby git:(master) ruby benchmarks/bm_find.rb
        Rehearsal -------------------------------------------------------------
        NAME_SHORT                  1.550000   0.010000   1.560000 (  1.563616)
        NAME_SHORT (noprivate)      2.060000   0.020000   2.080000 (  2.117548)
        NAME_MEDIUM                 1.720000   0.020000   1.740000 (  1.760489)
        NAME_MEDIUM (noprivate)     2.430000   0.020000   2.450000 (  2.649166)
        NAME_LONG                   1.630000   0.000000   1.630000 (  1.643268)
        NAME_LONG (noprivate)       2.210000   0.020000   2.230000 (  2.262352)
        NAME_WILD                   0.600000   0.000000   0.600000 (  0.601043)
        NAME_WILD (noprivate)       1.320000   0.070000   1.390000 (  1.475682)
        NAME_EXCP                   0.940000   0.060000   1.000000 (  1.071000)
        NAME_EXCP (noprivate)       1.120000   0.010000   1.130000 (  1.136978)
        IAAA                        0.690000   0.000000   0.690000 (  0.694769)
        IAAA (noprivate)            1.010000   0.010000   1.020000 (  1.011105)
        IZZZ                        0.560000   0.000000   0.560000 (  0.569191)
        IZZZ (noprivate)            0.900000   0.000000   0.900000 (  0.895128)
        PAAA                        7.310000   0.090000   7.400000 (  8.036596)
        PAAA (noprivate)            7.910000   0.080000   7.990000 (  8.450394)
        PZZZ                        1.060000   0.000000   1.060000 (  1.109186)
        PZZZ (noprivate)            1.390000   0.010000   1.400000 (  1.411946)
        JP                         50.590000   0.390000  50.980000 ( 52.698865)
        JP (noprivate)             49.840000   0.230000  50.070000 ( 50.385524)
        IT                          9.440000   0.020000   9.460000 (  9.502403)
        IT (noprivate)              9.940000   0.030000   9.970000 ( 10.008055)
        COM                         8.610000   0.030000   8.640000 (  8.657849)
        COM (noprivate)             9.330000   0.130000   9.460000 (  9.700029)
        -------------------------------------------------- total: 175.410000sec
    
                                       user     system      total        real
        NAME_SHORT                  1.580000   0.000000   1.580000 (  1.588811)
        NAME_SHORT (noprivate)      2.000000   0.010000   2.010000 (  2.024544)
        NAME_MEDIUM                 1.960000   0.020000   1.980000 (  2.012659)
        NAME_MEDIUM (noprivate)     2.150000   0.020000   2.170000 (  2.193273)
        NAME_LONG                   1.660000   0.000000   1.660000 (  1.666938)
        NAME_LONG (noprivate)       2.010000   0.000000   2.010000 (  2.018177)
        NAME_WILD                   0.600000   0.000000   0.600000 (  0.601061)
        NAME_WILD (noprivate)       0.920000   0.000000   0.920000 (  0.920315)
        NAME_EXCP                   0.700000   0.010000   0.710000 (  0.708406)
        NAME_EXCP (noprivate)       1.260000   0.010000   1.270000 (  1.298971)
        IAAA                        0.810000   0.010000   0.820000 (  0.829160)
        IAAA (noprivate)            1.180000   0.000000   1.180000 (  1.207569)
        IZZZ                        0.640000   0.010000   0.650000 (  0.646752)
        IZZZ (noprivate)            1.020000   0.000000   1.020000 (  1.037327)
        PAAA                        6.180000   0.020000   6.200000 (  6.227082)
        PAAA (noprivate)            6.970000   0.050000   7.020000 (  7.089971)
        PZZZ                        0.930000   0.000000   0.930000 (  0.937254)
        PZZZ (noprivate)            1.310000   0.010000   1.320000 (  1.324235)
        JP                         47.930000   0.200000  48.130000 ( 48.440196)
        JP (noprivate)             48.440000   0.260000  48.700000 ( 49.110888)
        IT                          9.660000   0.090000   9.750000 (  9.874755)
        IT (noprivate)              9.950000   0.070000  10.020000 ( 10.163920)
        COM                         7.930000   0.020000   7.950000 (  7.986893)
        COM (noprivate)             8.170000   0.010000   8.180000 (  8.186619)
    
    Using Hash:
    
        ➜  publicsuffix-ruby git:(thesis-hash) ruby benchmarks/bm_find.rb
        Rehearsal -------------------------------------------------------------
        NAME_SHORT                  0.310000   0.000000   0.310000 (  0.363447)
        NAME_SHORT (noprivate)      0.360000   0.000000   0.360000 (  0.402509)
        NAME_MEDIUM                 0.320000   0.000000   0.320000 (  0.317237)
        NAME_MEDIUM (noprivate)     0.410000   0.000000   0.410000 (  0.413092)
        NAME_LONG                   0.400000   0.000000   0.400000 (  0.396608)
        NAME_LONG (noprivate)       0.510000   0.000000   0.510000 (  0.510915)
        NAME_WILD                   0.390000   0.000000   0.390000 (  0.393804)
        NAME_WILD (noprivate)       0.510000   0.010000   0.520000 (  0.507487)
        NAME_EXCP                   0.400000   0.000000   0.400000 (  0.401723)
        NAME_EXCP (noprivate)       0.520000   0.000000   0.520000 (  0.525549)
        IAAA                        0.240000   0.000000   0.240000 (  0.244243)
        IAAA (noprivate)            0.360000   0.000000   0.360000 (  0.359558)
        IZZZ                        0.250000   0.000000   0.250000 (  0.249716)
        IZZZ (noprivate)            0.360000   0.000000   0.360000 (  0.356862)
        PAAA                        0.440000   0.000000   0.440000 (  0.445464)
        PAAA (noprivate)            0.590000   0.000000   0.590000 (  0.591834)
        PZZZ                        0.450000   0.000000   0.450000 (  0.446044)
        PZZZ (noprivate)            0.520000   0.000000   0.520000 (  0.524458)
        JP                          0.320000   0.000000   0.320000 (  0.327063)
        JP (noprivate)              0.430000   0.000000   0.430000 (  0.430906)
        IT                          0.270000   0.000000   0.270000 (  0.265015)
        IT (noprivate)              0.340000   0.000000   0.340000 (  0.345299)
        COM                         0.250000   0.000000   0.250000 (  0.244028)
        COM (noprivate)             0.340000   0.010000   0.350000 (  0.343862)
        ---------------------------------------------------- total: 9.310000sec
    
                                       user     system      total        real
        NAME_SHORT                  0.220000   0.000000   0.220000 (  0.221509)
        NAME_SHORT (noprivate)      0.320000   0.000000   0.320000 (  0.329044)
        NAME_MEDIUM                 0.290000   0.000000   0.290000 (  0.296088)
        NAME_MEDIUM (noprivate)     0.390000   0.000000   0.390000 (  0.393592)
        NAME_LONG                   0.420000   0.000000   0.420000 (  0.419251)
        NAME_LONG (noprivate)       0.500000   0.000000   0.500000 (  0.499873)
        NAME_WILD                   0.420000   0.000000   0.420000 (  0.421002)
        NAME_WILD (noprivate)       0.480000   0.000000   0.480000 (  0.485180)
        NAME_EXCP                   0.400000   0.000000   0.400000 (  0.401010)
        NAME_EXCP (noprivate)       0.510000   0.000000   0.510000 (  0.506889)
        IAAA                        0.250000   0.000000   0.250000 (  0.257035)
        IAAA (noprivate)            0.350000   0.000000   0.350000 (  0.352895)
        IZZZ                        0.250000   0.000000   0.250000 (  0.250804)
        IZZZ (noprivate)            0.350000   0.010000   0.360000 (  0.352272)
        PAAA                        0.440000   0.000000   0.440000 (  0.444238)
        PAAA (noprivate)            0.540000   0.000000   0.540000 (  0.549019)
        PZZZ                        0.440000   0.000000   0.440000 (  0.449137)
        PZZZ (noprivate)            0.550000   0.000000   0.550000 (  0.559688)
        JP                          0.330000   0.000000   0.330000 (  0.337413)
        JP (noprivate)              0.450000   0.010000   0.460000 (  0.458545)
        IT                          0.240000   0.000000   0.240000 (  0.247337)
        IT (noprivate)              0.350000   0.000000   0.350000 (  0.351233)
        COM                         0.260000   0.000000   0.260000 (  0.261882)
        COM (noprivate)             0.340000   0.000000   0.340000 (  0.347857)
  7. Experiment with different hostname-to-names algorithms

    weppos committed Jan 7, 2017
    ➜  publicsuffix-ruby git:(thesis-hash) ✗ ruby benchmarks/bm_parts.rb
    Warming up --------------------------------------
              tokenizer1    26.384k i/100ms
              tokenizer2    26.571k i/100ms
              tokenizer3    32.293k i/100ms
              tokenizer4    27.595k i/100ms
    Calculating -------------------------------------
              tokenizer1    310.488k (± 6.6%) i/s -      1.557M in 5.035961s
              tokenizer2    308.801k (± 8.3%) i/s -      1.541M in 5.027643s
              tokenizer3    378.716k (± 5.3%) i/s -      1.905M in 5.045422s
              tokenizer4    305.493k (± 9.6%) i/s -      1.518M in 5.018550s
    
    Comparison:
              tokenizer3:   378716.5 i/s
              tokenizer1:   310488.3 i/s - 1.22x  slower
              tokenizer2:   308800.6 i/s - 1.23x  slower
              tokenizer4:   305493.5 i/s - 1.24x  slower
  8. Change lookup algorithm to Hash

    weppos committed Jan 7, 2017
    The Hash doesn't require manual reindexing when new rules are added.
    Moreover, the Hash-based algorithm has almost O(1) lookup time.
    
    Actually, the lookup time is O(k), where k is the number of parts in
    the input string.
    
        find("www.example.com") -> k = 2
        find("www.example.com") -> k = 3
        find("www.subdomain.example.com") -> k = 4
    
    It's fair to consider that the average number of parts is 3, and
    hostnames longer than 5 parts are quite uncommon.
    
    Note that the Hash-based lookup is highly influenced by whatever
    underlying Hash implementation is provided by the programming language.
    A Perfect Hash would be preferable in terms of lookup time as it offers
    real O(1) lookup time complexity (whereas a dynamic Hash is avg O(1)),
    however a Perfect Hash would require a computation of a perfect hashing
    function, without considering that it would not allow the flexibility
    of adding/removing rules at runtime.
  9. Add more profilers

    weppos committed Jan 24, 2017
  10. PublicSuffix::List is no longer enumerable

    weppos committed Jan 24, 2017
    Although the list is still a collection of rules, the idea is that the
    internal list representation is shifting away from a simple collection,
    and looping over rules is not only discouraged but it may actually be
    impossible in the future.
    
    Moreover, including Enumerable will introduce a bunch of methods.
    
    Instead, if you really need to iterate over the collection, simply use
    #each that returns an Enumerator.
  11. Add tests to cover #each

    weppos committed Jan 24, 2017
Commits on Jan 23, 2017
  1. Deal with Minitest assert_nil warnings

    weppos committed Jan 23, 2017
  2. Reduce string allocation

    weppos committed Jan 23, 2017
Commits on Jan 22, 2017
  1. More focus on slow executions

    weppos committed Jan 22, 2017
  2. Use require_relative to load subfiles

    weppos committed Jan 22, 2017
    Otherwise, what can happen is that if you require the library without
    adding it to the load path AND the gem is installed, the main file will
    load the subfiles from the gem instead that from the same code.
    
    It happened for the benchmarks.
    
        require 'benchmark'
        require_relative '../lib/public_suffix'
    
        ...
    
    will load the file `lib/public_suffix` from this repo, but then
    `lib/public_suffix` will attempt to require the file
    `public_suffix/version` in your load path instead of
    ``lib/public_suffix/version`
  3. Focus on #find vs #select

    weppos committed Jan 22, 2017
  4. Reduce the length of certain domain, when not relevant

    weppos committed Jan 22, 2017
    Before:
    
        ➜  publicsuffix-ruby git:(3550d13) ruby benchmarks/bm_valid.rb
    
                                      user     system      total        real
        NAME_SHORT                  2.280000   0.010000   2.290000 (  2.298137)
        NAME_SHORT (noprivate)      2.570000   0.010000   2.580000 (  2.589651)
        NAME_MEDIUM                 2.390000   0.010000   2.400000 (  2.411466)
        NAME_MEDIUM (noprivate)     2.700000   0.020000   2.720000 (  2.721335)
        NAME_LONG                   2.550000   0.010000   2.560000 (  2.579820)
        NAME_LONG (noprivate)       2.800000   0.010000   2.810000 (  2.824161)
        NAME_WILD                   1.510000   0.010000   1.520000 (  1.521867)
        NAME_WILD (noprivate)       1.780000   0.020000   1.800000 (  1.810911)
        NAME_EXCP                   1.510000   0.010000   1.520000 (  1.526100)
        NAME_EXCP (noprivate)       1.780000   0.000000   1.780000 (  1.779788)
        IAAA                        1.520000   0.000000   1.520000 (  1.523923)
        IAAA (noprivate)            2.090000   0.030000   2.120000 (  2.145431)
        IZZZ                        1.760000   0.010000   1.770000 (  1.857560)
        IZZZ (noprivate)            1.800000   0.020000   1.820000 (  1.830710)
        PAAA                        7.960000   0.070000   8.030000 (  8.211680)
        PAAA (noprivate)            7.830000   0.080000   7.910000 (  8.069348)
        PZZZ                        1.880000   0.020000   1.900000 (  1.917670)
        PZZZ (noprivate)            2.070000   0.010000   2.080000 (  2.116736)
        JP                         48.060000   0.280000  48.340000 ( 49.707991)
        JP (noprivate)             47.620000   0.250000  47.870000 ( 48.146570)
        IT                         11.100000   0.060000  11.160000 ( 11.208886)
        IT (noprivate)             11.550000   0.070000  11.620000 ( 11.692874)
        COM                        10.580000   0.100000  10.680000 ( 10.779551)
        COM (noprivate)            10.400000   0.060000  10.460000 ( 10.522564)
    
    After:
    
        ➜  publicsuffix-ruby git:(master) ✗ ruby benchmarks/bm_valid.rb
    
                                       user     system      total        real
        NAME_SHORT                  2.140000   0.000000   2.140000 (  2.137489)
        NAME_SHORT (noprivate)      2.460000   0.010000   2.470000 (  2.469564)
        NAME_MEDIUM                 2.280000   0.000000   2.280000 (  2.281684)
        NAME_MEDIUM (noprivate)     2.520000   0.000000   2.520000 (  2.527992)
        NAME_LONG                   2.370000   0.000000   2.370000 (  2.369214)
        NAME_LONG (noprivate)       2.570000   0.010000   2.580000 (  2.576050)
        NAME_WILD                   1.390000   0.000000   1.390000 (  1.391516)
        NAME_WILD (noprivate)       1.680000   0.000000   1.680000 (  1.686973)
        NAME_EXCP                   1.380000   0.000000   1.380000 (  1.383330)
        NAME_EXCP (noprivate)       1.690000   0.000000   1.690000 (  1.689423)
        IAAA                        1.380000   0.000000   1.380000 (  1.382728)
        IAAA (noprivate)            1.630000   0.010000   1.640000 (  1.637112)
        IZZZ                        1.300000   0.000000   1.300000 (  1.304215)
        IZZZ (noprivate)            1.550000   0.000000   1.550000 (  1.552017)
        PAAA                        7.030000   0.080000   7.110000 (  7.190563)
        PAAA (noprivate)            6.890000   0.000000   6.890000 (  6.900262)
        PZZZ                        1.660000   0.010000   1.670000 (  1.669444)
        PZZZ (noprivate)            1.850000   0.000000   1.850000 (  1.855301)
        JP                         46.620000   0.270000  46.890000 ( 47.472670)
        JP (noprivate)             47.270000   0.250000  47.520000 ( 48.135562)
        IT                         10.350000   0.100000  10.450000 ( 10.601202)
        IT (noprivate)             10.900000   0.110000  11.010000 ( 11.222941)
        COM                         8.910000   0.050000   8.960000 (  9.020793)
        COM (noprivate)             9.310000   0.060000   9.370000 (  9.451161)
  5. Compute the length of the rule without allocating an array

    weppos committed Jan 7, 2017
    Do not use additional space. It's enough to count the dots, no need to
    split the rule.
  6. Merge branch 'thesis-start'

    weppos committed Jan 22, 2017
  7. Fix $ bundle compilation error in Ruby 2.3 and 2.4

    weppos committed Jan 22, 2017
  8. Add more effective benchmark (find vs valid)

    weppos committed Jan 22, 2017
    Valid requires to decompose the input, and adds an overhead. Instead,
    using #find I can better determine the cost of the #find call.
    
        ➜  publicsuffix-ruby git:(master) ✗ ruby benchmarks/bm_valid.rb
        Rehearsal -------------------------------------------------------------
        NAME_SHORT                  2.400000   0.010000   2.410000 (  2.431881)
        NAME_SHORT (noprivate)      2.890000   0.050000   2.940000 (  3.005929)
        NAME_MEDIUM                 2.910000   0.090000   3.000000 (  3.099855)
        NAME_MEDIUM (noprivate)     2.930000   0.020000   2.950000 (  2.979649)
        NAME_LONG                   2.710000   0.020000   2.730000 (  2.768214)
        NAME_LONG (noprivate)       3.110000   0.030000   3.140000 (  3.204438)
        NAME_WILD                   1.910000   0.080000   1.990000 (  2.086704)
        NAME_WILD (noprivate)       2.050000   0.030000   2.080000 (  2.112060)
        NAME_EXCP                   1.530000   0.010000   1.540000 (  1.544326)
        NAME_EXCP (noprivate)       1.830000   0.010000   1.840000 (  1.840148)
        IAAA                        1.600000   0.000000   1.600000 (  1.607783)
        IAAA (noprivate)            1.890000   0.000000   1.890000 (  1.901052)
        IZZZ                        1.510000   0.010000   1.520000 (  1.517555)
        IZZZ (noprivate)            1.800000   0.010000   1.810000 (  1.817985)
        PAAA                        8.030000   0.090000   8.120000 (  8.270579)
        PAAA (noprivate)            7.320000   0.020000   7.340000 (  7.365341)
        PZZZ                        1.870000   0.010000   1.880000 (  1.885046)
        PZZZ (noprivate)            2.000000   0.010000   2.010000 (  2.012714)
        JP                         50.790000   0.330000  51.120000 ( 52.795887)
        JP (noprivate)             49.840000   0.310000  50.150000 ( 50.678130)
        IT                         11.610000   0.100000  11.710000 ( 11.858061)
        IT (noprivate)             10.720000   0.010000  10.730000 ( 10.743938)
        COM                         9.690000   0.020000   9.710000 (  9.739030)
        COM (noprivate)            10.180000   0.030000  10.210000 ( 10.259466)
        -------------------------------------------------- total: 194.420000sec
    
        user     system      total        real
        NAME_SHORT                  2.190000   0.000000   2.190000 (  2.200740)
        NAME_SHORT (noprivate)      2.460000   0.000000   2.460000 (  2.468227)
        NAME_MEDIUM                 2.300000   0.010000   2.310000 (  2.304213)
        NAME_MEDIUM (noprivate)     3.150000   0.030000   3.180000 (  3.232415)
        NAME_LONG                   2.770000   0.020000   2.790000 (  2.854338)
        NAME_LONG (noprivate)       2.760000   0.000000   2.760000 (  2.766417)
        NAME_WILD                   1.420000   0.010000   1.430000 (  1.432541)
        NAME_WILD (noprivate)       1.780000   0.010000   1.790000 (  1.795507)
        NAME_EXCP                   1.430000   0.000000   1.430000 (  1.437950)
        NAME_EXCP (noprivate)       1.670000   0.000000   1.670000 (  1.671285)
        IAAA                        1.540000   0.010000   1.550000 (  1.542538)
        IAAA (noprivate)            1.820000   0.000000   1.820000 (  1.831127)
        IZZZ                        1.430000   0.010000   1.440000 (  1.439348)
        IZZZ (noprivate)            1.810000   0.010000   1.820000 (  1.845050)
        PAAA                        7.600000   0.110000   7.710000 (  7.848176)
        PAAA (noprivate)            6.850000   0.010000   6.860000 (  6.860310)
        PZZZ                        1.670000   0.000000   1.670000 (  1.669032)
        PZZZ (noprivate)            1.890000   0.000000   1.890000 (  1.897537)
        JP                         45.650000   0.180000  45.830000 ( 46.127456)
        JP (noprivate)             47.030000   0.110000  47.140000 ( 47.385492)
        IT                         10.480000   0.020000  10.500000 ( 10.515058)
        IT (noprivate)             10.610000   0.010000  10.620000 ( 10.638714)
        COM                        10.310000   0.090000  10.400000 ( 10.540724)
        COM (noprivate)            11.030000   0.090000  11.120000 ( 11.441387)
    
    vs
    
        ➜  publicsuffix-ruby git:(master) ✗ ruby benchmarks/bm_find.rb
        Rehearsal -------------------------------------------------------------
        NAME_SHORT                  1.500000   0.010000   1.510000 (  1.518221)
        NAME_SHORT (noprivate)      2.110000   0.030000   2.140000 (  2.213987)
        NAME_MEDIUM                 1.660000   0.000000   1.660000 (  1.681097)
        NAME_MEDIUM (noprivate)     2.000000   0.010000   2.010000 (  2.026092)
        NAME_LONG                   1.710000   0.000000   1.710000 (  1.717539)
        NAME_LONG (noprivate)       2.420000   0.020000   2.440000 (  2.728341)
        NAME_WILD                   0.630000   0.000000   0.630000 (  0.633734)
        NAME_WILD (noprivate)       1.050000   0.000000   1.050000 (  1.124908)
        NAME_EXCP                   1.000000   0.010000   1.010000 (  1.256310)
        NAME_EXCP (noprivate)       1.480000   0.010000   1.490000 (  1.858576)
        IAAA                        1.060000   0.000000   1.060000 (  1.174612)
        IAAA (noprivate)            1.140000   0.010000   1.150000 (  1.143543)
        IZZZ                        0.610000   0.000000   0.610000 (  0.612447)
        IZZZ (noprivate)            1.000000   0.000000   1.000000 (  1.011670)
        PAAA                        6.910000   0.040000   6.950000 (  7.537147)
        PAAA (noprivate)            6.480000   0.020000   6.500000 (  6.565181)
        PZZZ                        0.810000   0.000000   0.810000 (  0.822222)
        PZZZ (noprivate)            1.200000   0.000000   1.200000 (  1.201767)
        JP                         49.650000   0.330000  49.980000 ( 52.399795)
        JP (noprivate)             50.580000   0.540000  51.120000 ( 53.123797)
        IT                         10.260000   0.090000  10.350000 ( 10.462243)
        IT (noprivate)              9.890000   0.010000   9.900000 (  9.915310)
        COM                         8.710000   0.020000   8.730000 (  8.775702)
        COM (noprivate)             8.940000   0.010000   8.950000 (  8.961991)
        -------------------------------------------------- total: 173.960000sec
    
        user     system      total        real
        NAME_SHORT                  1.410000   0.010000   1.420000 (  1.415990)
        NAME_SHORT (noprivate)      1.760000   0.000000   1.760000 (  1.762023)
        NAME_MEDIUM                 1.570000   0.000000   1.570000 (  1.575709)
        NAME_MEDIUM (noprivate)     1.930000   0.000000   1.930000 (  1.929677)
        NAME_LONG                   1.560000   0.010000   1.570000 (  1.561451)
        NAME_LONG (noprivate)       1.880000   0.000000   1.880000 (  1.885979)
        NAME_WILD                   0.580000   0.000000   0.580000 (  0.572888)
        NAME_WILD (noprivate)       0.880000   0.000000   0.880000 (  0.882760)
        NAME_EXCP                   0.640000   0.000000   0.640000 (  0.641299)
        NAME_EXCP (noprivate)       0.990000   0.000000   0.990000 (  0.992167)
        IAAA                        0.720000   0.000000   0.720000 (  0.720518)
        IAAA (noprivate)            1.120000   0.010000   1.130000 (  1.138187)
        IZZZ                        0.810000   0.020000   0.830000 (  0.878696)
        IZZZ (noprivate)            1.200000   0.040000   1.240000 (  1.296653)
        PAAA                        6.820000   0.230000   7.050000 (  7.303155)
        PAAA (noprivate)            7.340000   0.250000   7.590000 (  7.853675)
        PZZZ                        0.900000   0.000000   0.900000 (  0.912295)
        PZZZ (noprivate)            1.180000   0.010000   1.190000 (  1.199639)
        JP                         48.180000   0.740000  48.920000 ( 50.066837)
        JP (noprivate)             49.560000   0.420000  49.980000 ( 51.103312)
        IT                         10.330000   0.090000  10.420000 ( 10.592352)
        IT (noprivate)             10.430000   0.080000  10.510000 ( 10.563008)
        COM                         8.860000   0.060000   8.920000 (  8.960364)
        COM (noprivate)            10.010000   0.100000  10.110000 ( 10.248432)
  9. Do not run benchmarks by default

    weppos committed Jan 22, 2017
Commits on Jan 7, 2017
  1. PublicSuffix::List#select is now private

    weppos committed Jan 7, 2017
    Note that this method is currently private, as you should not rely on
    it. Instead, the public interface is {#find}. The current internal
    algorithm allows to return all matching rules, but different data
    structures may not be able to do it, and instead would return only the
    match.
    
    For this reason, you should rely on {#find}.
  2. Removed `PublicSuffix::List.clear`

    weppos committed Jan 7, 2017
    It was an unnecessary accessor method. Use
    
        PublicSuffix::List.default = nil
    
    if you **really** need to reset the default list. You shouldn't.
  3. Do not duplicate builds

    weppos committed Jan 7, 2017
  4. Add benchmarks to Travis

    weppos committed Jan 7, 2017
  5. PublicSuffix::List#rules is now protected

    weppos committed Jan 7, 2017
    You should not rely on it as the internal rule representation is
    subject to change to optimize performances.
  6. Update RuboCop rules

    weppos committed Jan 7, 2017
  7. Fix some MT6 assert_nil deprecations

    weppos committed Jan 7, 2017
Commits on Jan 2, 2017
  1. Release 2.0.5

    weppos committed Jan 2, 2017
  2. Update definitions

    weppos committed Jan 2, 2017