I am parsing 4 large XML files through threads and somehow the multithreaded code is slower then the sequential code?
Python uses the GIL (Global Interpreter Lock) to ensure only one thread executes Python code at a time. This is done to prevent data races and for some other reasons. That, however, means that multithreading in the default CPython will barely give you any code speedup (if it won't slow it down, as it did in your case).
To efficiently parallelize your workload, look into Python's
multiprocessing module, which instead launches separate processes that are not affected by each other's GIL
Here's a SO question on that topic