1. 20
  1.  

  2. 0

    I find it strange that etc hosts is not parsed into a trie. it is used linearly.

    1. 2

      Isnt it evaluated linearly to be deterministic …? If it was a Trie datastructure what would that buy you and would “a lookup” still be deterministic for a sysadmin to understand precedence defined within the file.

      I suppose a big question is – is it quicker to find a plain needle in the file vs build a Trie for a typical hosts file …

      1. 2

        If it was a Trie datastructure what would that buy you

        log time instead of linear time. This allows you to have a very large hosts file without slowing down internet use.

        would “a lookup” still be deterministic

        yeah, you can ensure that happens in the implementation.

        I suppose a big question is – is it quicker to find a plain needle in the file vs build a Trie for a typical hosts file …

        Building the trie is slower than searching through the file but the only needs to be done when the file is edited.

        1. 2

          Have you numbers on how big it would have to be? Without knowing that, this reeks of premature optimization.