Benchmarking a Rust function

Once in a while I like to play with Advent Of Code problems 馃巹. Today I decided to tackle an easy one and, since the answer was almost trivial to find, I wanted to go deeper and understand how to measure and improve the performance of the solution. ...

April 2, 2023 路 Andrea Manzini

web components with Nim and Karax

Inspired by a tweet from a fellow developer, I decided to take a look at Karax, a nifty framework for developing single page applications in Nim. After following the basic tutorials and examples, I searched for something more complex and found very sparse documentation, so I鈥檒l write my findings here. As usual, the complete source code is on my github repo, where you can find also a working live demo....

July 7, 2022 路 Andrea Manzini

integration between Python and Rust - Part 2

In this post we are going to write a new module for python: a very simple function exported from Rust that we can consume in the Python interpreter. We鈥檒l leverage the PyO3 Rust bindings for the Python interpreter. Let鈥檚 start with a new Cargo project: $ cargo init --lib demo_rust_lib and insert the required settings in Cargo.toml: [package] name = "rusty" version = "0.1.0" edition = "2021" [lib] name="rusty" crate-type = ["cdylib"] [dependencies....

January 7, 2022 路 Andrea Manzini

integration between Python and Rust - Part 1

Let鈥檚 get our feet wet; in this first part I鈥檒l write about a very simple way to interface Rust and Python. First of all let鈥檚 build a Rust dynamic library with some basic functions. // this file is: src/lib.rs #[no_mangle] pub extern "C" fn hello() { println!("Hello from the library!"); } #[no_mangle] pub extern "C" fn sum(a: i32, b: i32) -> i32 { a + b } your Cargo.toml should look like this:...

August 18, 2021 路 Andrea Manzini