Interview practice question
CPU-heavy transformation is slow
Data Engineering · Python · Experienced
A Python job that parses and transforms millions of XML documents is CPU-bound and slow. How do you speed it up?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Threads won't help CPU-bound pure Python because of the GIL.
- Use multiprocessing or ProcessPoolExecutor across cores.
- Use faster parsers like lxml.
- Batch work to reduce inter-process overhead.
- For bigger scale, distribute with Spark or similar.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.