title: Python - Is a dict or list better suited for efficiently storing and searching this data?
body: <p><strong>Here's the scenario:</strong></p>
  
  <ol>
  <li>I'm parsing a log file and turning each individual line (string) from the log file into a hierarchical structure. I want to be able to categorize each message as belonging to a particular event on a particular day. </li>
  <li>I'm trying to send this data structure to the front-end of my Django app and display this hierarchical structure, and prevent the front-end from having to handle all these computations.</li>
  <li>On the front end I would like to be able to search by key words and display results that do this. Either I can search the data structure the back-end sends over, or I can search the rendered DOM.</li>
  </ol>
  
  <p>I have the following data:</p>
  
  <pre class="lang-none prettyprint-override"><code>Day 1
     Event 1
        message
        message
        message
     Event 2
        message
        message
        message
     Event 3
        message
        message
        message
  Day 2
     Event 1
        message
        message
        message
     Event 2
        message
        message
        message
  
  ...
  </code></pre>
  
  <p><strong>The data</strong></p>
  
  <p>One event in the log file would look something like this:</p>
  
  <pre class="lang-none prettyprint-override"><code>2019-08-05 09:18:45 -- INFO -- all buttons -- THOR: All button were pressed.
  2019-08-05 09:18:48 -- WARNING -- THOR1: The system failed to connect. Is the asset online? If so, did the password change?
  2019-08-05 09:18:51 -- WARNING -- THOR2: The system failed to connect. Is the asset online? If so, did the password change?
  2019-08-05 09:18:51 -- WARNING -- THOR3: Looks like it's online, but the system was unable to log in.
  2019-08-05 09:18:51 -- WARNING -- THOR4: Looks like it's online, but the system was unable to log in.
  2019-08-05 09:18:51 -- WARNING -- THOR5: Looks like it's online, but the system was unable to log in.
  2019-08-05 09:18:52 -- WARNING -- THOR6: Looks like it's online, but the system was unable to log in.
  </code></pre>
  
  <p><strong>My current approach</strong></p>
  
  <p>So far I have the data stored (extremely crudely) as </p>
  
  <pre class="lang-none prettyprint-override"><code>Day 1    Event 1               Event 2              Day 2     Event 1
    |         |                    |                    |          |
    |         |                    |                    |          |
    |  _______|                    |                    |  ________|
    | |                            |                    | |
  [ [ [message, message, message], [message, message]], [ [message, message], ... ], ... ]
  </code></pre>
  
  <p><strong>Maybe a better way?</strong></p>
  
  <pre class="lang-py prettyprint-override"><code>{
  
     '08/05/2019': {
        '09:18': [message, message, message],
        '10:30': [message, message, message, message],
        '14:40': [message]
     }
  
     '08/03/2019': {
        '06:40': [message, message],
        '17:25': [message, message]
     }
  
  }
  </code></pre>
  
  <hr>
  
  <p><strong>Conclusion</strong></p>
  
  <p>I need to preserve order so I can show these in chronological order on the front end, but would a dict be more efficient for something like this? This might be viable since <a href="https://stackoverflow.com/questions/60848/how-do-you-retrieve-items-from-a-dictionary-in-the-order-that-theyre-inserted/51777540#51777540">Python dicts now maintain insertion order</a>.</p>
  
  <p>Which data structure would be more efficient for storing and searching? I should note that I'll probably be dealing with around 60,000 messages.</p>