Workshops small

How we sped up NumPy’s string operations by 100x

kindly offered byPyGreece

Date / Time: Friday 22 November / 14:25 AM - 15:40 EET @ Workshop room (-1st floor - Room 2)

Speaker: Lysandros Nikolaou
Senior Software Engineer at Quansight Labs – CPython Core Developer

Workshop Description:

After a huge amount of work from many people, NumPy 2.0.0 has been released, the first major NumPy release since 2006! Among the many new features, several changes to both the Python API and the C API, and a great deal of documentation improvements, there was also a lot of work on improving the performance of string operations.
In this workshop, we’ll dive deep into NumPy ufunc internals and work on topics like NumPy (parametric) dtypes, type promotion, and more. By the end of the workshop, attendees will have gained a basic understanding of how NumPy does its magic, hopefully improving how they use this incredibly powerful library in the process.


What will you Learn:

  • A better understanding of Python and NumPy internals
  • How to harness the Python & NumPy C APIs to make your critical paths more performant
  • How to use asv to benchmark your code

 

Level: Intermediate

TAGs: #python #c #c++ #numpy #performance #optimizations #cpython-c-api #numpy-c-api

Target audience: Developers interested in performance optimizations, C/C++ lovers, Python/NumPy users, Python developers interested in the inner workings of Python and the Python C API

Prerequisites on Audience: 

  • Laptop (not required, attendees will be able to follow the workshop by looking at the presentation as well).
  • Git, Python, Pip installed.
  • Experience in working with Python & C/C++.

Deliverables: 

  • A stand-alone project that builds upon the NumPy C API to make NumPy’s string ufuncs faster.
  • Some benchmarking code to verify the improvement.

Schedule: 

Introduction (10 minutes)

  • Brief overview of the Python and NumPy C APIs
  • Intro to NumPy dtypes and ufuncs

Deep dive into NumPy internals (55 minutes)

  • Understand why NumPy string ufuncs are slow
  • Build benchmarks to start optimizing
  • Write C/C++ code to make NumPy string ufuncs faster
  • Analyze benchmarking results

 Conclusion (5 minutes)

  • Recap of key learnings around Python and NumPy
  • How to use the workshop’s learning to improve your own Python/C code

Q&A (5 minutes)