Python Conference APAC 2024

Irwan Shofwan

As an engineer, I thrive on unraveling complex systems and solving technical challenges. Beyond my professional pursuits, I have a passion for cooking and exploring diverse cuisines.


Links to social media profile / website / github

https://id.linkedin.com/in/irwanshofwan


Session

10-26
13:00
30min
Optimizing Python Performance: Strategies for Infrastructure Automation and Beyond
Irwan Shofwan, Didi Yudha Perwira

Enhancing the performance of Python scripts is a critical challenge for developers striving to optimize efficiency and reduce execution time. This presentation will delve into various methodologies for improving Python script performance, including threading, multiprocessing, and application refactoring.

Python's Global Interpreter Lock (GIL) presents significant challenges in achieving true parallelism, as it permits only one thread to execute at a time, even in a multi-threaded context. We will discuss the implications of the GIL on threading and highlight scenarios where No GIL implementations or workarounds can be advantageous.

Although threading and multiprocessing enable parallel execution, they do not inherently ensure faster runtimes. Threading can be effective for I/O-bound tasks, whereas multiprocessing is more suitable for CPU-bound operations. However, both approaches introduce complexity and potential overhead that can negate performance gains.

Conversely, refactoring the application can lead to substantial performance improvements. By optimizing algorithms, reducing complexity, and leveraging efficient data structures, developers can achieve significant runtime reductions. This presentation will provide practical examples and case studies illustrating how refactoring can be a more effective strategy for performance enhancement compared to merely adding parallelism.

Additionally, this talk will outline our journey to enhance our infrastructure automation, employing several approaches and comparing each to achieve notable improvements. By implementing these strategies, we accomplished a 90% reduction in running time and met our SLA, thereby enhancing productivity. This presentation will offer practical examples and an in-depth exploration of approaches that may be applicable to other use cases as well.

CLASS #6