(filename: str, parser: str)
| 26 | |
| 27 | |
| 28 | def python(filename: str, parser: str) -> Tuple[int, float, float]: |
| 29 | start_load = perf_counter() |
| 30 | with open(filename, encoding="utf8") as fp: |
| 31 | soup = BeautifulSoup(fp, parser) |
| 32 | |
| 33 | end_load = perf_counter() |
| 34 | start_search = perf_counter() |
| 35 | |
| 36 | links = soup.select("a[href]") |
| 37 | end_search = perf_counter() |
| 38 | |
| 39 | return len(links), end_load - start_load, end_search - start_search |
| 40 | |
| 41 | |
| 42 | def main(): |