Thu 08 Jun 2023

Understanding CPUs can help speed up Numba and NumPy code

When you need to speed up your NumPy processing—or just reduce your memory usage—the Numba just-in-time compiler is a great tool. It lets you write Python code that gets compiled at runtime to machine code, allowing you to get the kind of speed improvements you’d get from languages like C, Fortran, or Rust.

Or at least, that’s the theory. In practice, your initial Numba code may be no faster than the NumPy equivalent.

But you can do better, once you have a better understanding of how CPUs work. And this knowledge will help you more broadly with any compiled language.

Source: Understanding CPUs can help speed up Numba and NumPy code, an article by Itamar Turner-Trauring.

Why Liquid Haskell matters

Liquid Haskell is a tool that can analyse a program and calculate proof obligations that would ensure that the program meets some specification (not unlike Dafny, Why3, or F*). The specification is included in the program as a special comment inserted by the programmer. The compiler ignores this comment, but Liquid Haskell can find it. Once the proof obligations are identified, they are given to a theorem prover (an SMT solver specifically) in an attempt to save the programmer the trouble of writing a proof.

Source: Why Liquid Haskell matters, an article by Facundo Domínguez.

Rate limiting in HAProxy and Nginx

Rate-limiting is a common strategy for safe guarding a server from potential DDoS attacks or sudden peaks in network traffic. Rate-limiting instructs the server to block requests from certain IP addresses that are sending an unusual number of requests to the system.

We can apply rate-limiting to both Nginx and HAProxy. Nginx runs on each end node hosting the service, while HAProxy serves as the load-balancer and distributes incoming requests among available nodes. This post describes how to rate-limit requests on both Nginx and HAProxy and shows how to whitelist IPs and rate-limit a single URL. The final section shows how to apply this configuration in Puppet.

Source: Rate limiting in HAProxy and Nginx, an article by Adeel Ahmad.

Hunter Killer (2018)

An untested American submarine captain teams with U.S. Navy Seals to rescue the Russian president, who has been kidnapped by a rogue general.

In the evening Esme and I watched Hunter Killer. I liked the movie and give it a 7 out of 10.