Skip to content

Commit

Permalink
Approach 6: Use read_line instead of read_lines (Time: 105s)
Browse files Browse the repository at this point in the history
In the read_lines method of BufReader, we allocated memory for each
line. This can be seen via the malloc call that was made on each
read_line. This meant an extra overhead of creating String on memory for
each line.

We now use a single buffer to store each line, this way we can avoid the
expensive malloc
  • Loading branch information
Naveenaidu committed Jul 14, 2024
1 parent afc73a1 commit d4b60cf
Show file tree
Hide file tree
Showing 2 changed files with 507 additions and 8 deletions.
Loading

0 comments on commit d4b60cf

Please sign in to comment.