Performance: Overlap and chunk boundaries
MEDIUM IMPACT
This concept affects how quickly and efficiently text data is processed and retrieved in Langchain, impacting response time and memory usage.
text_chunks = [] chunk_size = 500 overlap = 50 for i in range(0, len(text), chunk_size - overlap): text_chunks.append(text[i:i+chunk_size]) embeddings = [embed(chunk) for chunk in text_chunks]
text_chunks = text.split('\n\n') # Splitting only by paragraphs without overlap embeddings = [embed(chunk) for chunk in text_chunks]
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No overlap chunking | N/A | N/A | N/A | [X] Bad |
| Overlap chunking with controlled boundaries | N/A | N/A | N/A | [OK] Good |