NVIDIA-NeMo / NVIDIA-NeMo/Curator
CommonCrawl - Consider using fastwarc instead of warcio
Open
Nobody has claimed this yet.
enhancement
Stale
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 328
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 30
Description
Performance speedup of ~25% when tested locally
Here is pseudocode
from fastwarc.warc import ArchiveIterator as FastArchiveIterator
from fastwarc.warc import WarcRecordType
from fastwarc.stream_io import FileStream, GZipStream
# For GZip-compressed local files
def process_warc_new(warc_path: Path | str) -> list[dict]:
results = []
filename = warc_path.name if isinstance(warc_path, Path) else warc_path.split("/")[-1]
archive_iterator = FastArchiveIterator(
GZipStream(FileStream(warc_path, "rb")),
record_types=WarcRecordType.response,
parse_http=True
)
for i, rec in enumerate(archive_iterator):
try:
content = rec.reader.read()
warc_id = rec.record_id[10:-1]
url = rec.headers['WARC-Target-URI']
results.append({"url": url, "warc_id": warc_id, "source_id": filename, "content": content})
except Exception as e: # noqa: BLE001
# Handle corruption or other errors
logger.error(f"Error processing record {i} in {filename}: {e!s}")
# Try to continue with next record
continue
return pd.DataFrame(results)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the CommonCrawl processing entry point that currently uses warcio, then compare its record handling with the fastwarc pseudocode in this issue. Check how compressed WARC files, response records, errors, and returned fields are handled. Done means fastwarc is integrated without changing results and the reported performance improvement is confirmed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-engineering
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100