<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Cython on Tyler Collins</title>
    <link>https://www.tk11br.ca/tags/cython/</link>
    <description>Recent content in Cython on Tyler Collins</description>
    <generator>Hugo</generator>
    <language>en</language>
    <copyright>2022-2026 Tyler Collins. Content licensed under CC BY-NC 4.0.</copyright>
    <lastBuildDate>Wed, 26 Mar 2025 12:00:00 -0400</lastBuildDate>
    <atom:link href="https://www.tk11br.ca/tags/cython/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Revisiting Cython: Is It Still Effective?</title>
      <link>https://www.tk11br.ca/posts/revisiting-cython/</link>
      <pubDate>Wed, 26 Mar 2025 12:00:00 -0400</pubDate>
      <guid>https://www.tk11br.ca/posts/revisiting-cython/</guid>
      <description>A 2025 reassessment of Cython&amp;#39;s performance, workflow, and place beside modern Python libraries and compilers.</description>
      <content:encoded><![CDATA[<p>I first presented Cython in 2020. Five years and several major releases later, I wanted to see whether that old advice still held up.</p>
<p>This talk looked at what changed in Cython, whether it got faster, and whether it became any easier to use. I worked through a few demo problems and compared the results with modern Python and its performance libraries.</p>
<iframe src="https://www.youtube.com/embed/n-T_8dSqd-s" title="Revisiting Cython: Is It Still Effective?" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<h2 id="abstract">Abstract</h2>
<p>Python is often praised for its speed of development but criticized for its execution speed. However, this has changed significantly in recent years due to major improvements in both Python itself and its most popular libraries. Libraries such as TensorFlow, OpenCV, NumPy, and Pandas all use a tool called Cython. Cython is an extension of Python that allows functions to be compiled into C or C++, mitigating Python&rsquo;s performance limitations.</p>
<p>Since the <a href="https://youtu.be/y6bKDKFavPA">last webinar on this package in 2020</a>, several major versions have been released. This talk will explore what has changed, whether performance has improved, and if development has become easier. During the webinar, a few demo problems will be explored live. Experience with Python is expected, while familiarity with C/C++ and Jupyter notebooks will be helpful.</p>
<p>The <a href="https://explora.alliancecan.ca/events/co-colloquium-revisiting-cython-is-it-still-effective">event page</a> has the event details.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Cython: A First Look</title>
      <link>https://www.tk11br.ca/posts/cython/</link>
      <pubDate>Sun, 20 Mar 2022 14:40:38 -0400</pubDate>
      <guid>https://www.tk11br.ca/posts/cython/</guid>
      <description>A first look at using Cython to recover performance when Python code needs to run faster.</description>
      <content:encoded><![CDATA[<p>Back when I first got hired at SHARCNET, I used a lot of Python. I mean a lot. This meant I quickly became the lightning rod for all Python-related questions and commentary.</p>
<p>During a fun Friday chat, a colleague remarked that Python was, on average, 40x slower than C++. I defended my current language of choice, saying it was better than that, surely. To make a long story short, I was wrong. It really is about 40x slower depending on the problem. Determined to prove myself capable, and my language of choice a bit more defensible, I decided to look into ways to make Python faster.</p>
<p>I eventually landed on Cython. It turns out the best way to make Python faster was to use as much C++ as possible.</p>
<p>Below is my abstract for the talk as well as the recording:</p>
<iframe src="https://www.youtube.com/embed/y6bKDKFavPA" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<p>&ldquo;Often we write programs in Python for convenience, not for speed. When work becomes elevated to High Performance Computing (HPC) environments, speed once again becomes a concern. Cython is an extension of Python which allows functions to be compiled as C (or C++) and recover the significant performance trade-offs of Python. Cython achieves this by supporting calling C functions, declaring of type information, as well as providing access to C++ STL functionality. Popular packages and libraries that take advantage of Cython include: TensorFlow, OpenCV, NumPy, Pandas, and more. This webinar will cover a basic introduction to Cython, a demo translating vanilla Python into Cython, followed by a short demo of how to run Cython in our own Compute Canada HPC environments. Experience with Python will be expected, while familiarity with C/C++ and Jupyter notebooks will be helpful. Webinar material and code will be made available on GitHub for reference.&rdquo;</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
