import mmap


def get_num_of_lines(filename):
    """Get number of lines of a file."""
    f = open(filename, "r+")
    buf = mmap.mmap(f.fileno(), 0)
    lines = 0
    readline = buf.readline
    while readline():
        lines += 1
    f.close()
    return lines