Sqlite3 is lightweight relational database, mainly focused on smaller local systems. Being used in Android it’s now probably most spread relational database in world with billions of instances running. Lite in the name means that it is not client-server architecture and it’s intended for lower data volumes – ideal usage profile is read mostly, with occasional writes. Sqlite3 is often used as an embedded data store in various applications (Firefox and Chrome are most prominent ones). Recently I’ve been playing a bit with sqlite3 interface in Rust and had run couple of simple tests especially focused on writes. So how does sqlite3 performs and how it compares with other more typical client-server RDBMS like PostgreSQL? It’s not any serious benchmark, just couple of toy tests to highlight few things. Continue reading Sqlite3 – How Slow Is Write?
Recently I’ve been reading this book: “Network Programming with Rust” by Abhishek Chanda. I found this book bit problematic. It’s just collection of many unrelated examples (often taken from crates documentation), with just little of background and concepts explanation and in some parts this book is just wrong, in other parts it’s using too much simplifications, so the result does not make much sense or worst it introduces some dangerous ideas. One of these places is part about futures and streams – let’s look at one example: Continue reading Future Never Sleeps
Although Rust is mostly noted for it’s memory safety and thus most prominent feature is borrow checker, it has also very decent type system, which was inspired by modern functional languages like OCAML or Haskel. In this article I’ll look into very simple example, which will however show some nice features of Rust type system – especially generics. Continue reading Tiny Etude in Generics
I have been playing with tokio already in couple of small projects (ptunnel-rust and indirectly (via hyper) in audioserve), but I cannot say that I’m proficient. Also tokio is very much moving target – what I used couple month ago is already bit outdated now(old version is tokio_core crate – where default executor was on current thread, now it’s work stealing thread pool). So I decided to refresh and deepen my knowledge and created a toy project – stupid jokes server – it’s a TCP sever, which sends a random joke to client after it connects and then closes connection. Jokes are stored in text file, separated by dashed lines. My main interest was to test how to use local file system I/Os, which are blocking by nature, with tokio asynchronous approach (so I initially skipped easiest and probably most efficient implementation, where all jokes would be cached in memory). Usually in a real project you’ll have some blocking code, so I need to know how to handle it. This article is history of my attempts (and failures) recorded in a hope that it might help others in learning tokio (and also writing it down helped me to absorb gained knowledge). Continue reading From Ignorance to Enlightenment – Playing with Tokio
Is thread pool worth to consider for my project? I was looking for some opinions around the net and as usual they differ and most common wisdom is it matters. Generally it’s “known” that creating and tearing down thread is “significant” overhead, so if you have a lot of small tasks thread pool is much better solution then spawning new thread for each task. But what is significant overhead? According to what I read time to create thread on Linux should be about 10μs (which does not look as too much to me) and app. 2MB of memory allocated for stack (configurable). I was considering thread pool in context of audioserve project, where I started with simplest possible solution (e.g. spawning individual threads ) and was wondering how much I’m loosing by not using thread pool. So I implemented simple thread pool (as learning exercise – long term audioserve solution should use tokio-threadpool) and add it to audioserve. In the remainder of this short article I’d like to share my findings and roughly quantify benefits of thread pool for such small project. Continue reading How much better is the thread pool?
So finally there is something. I’m using it myself now to listen to audiobooks and it have almost all functionality I wanted it to have. It might be still bit unstable and few things is not well behaving (keep up long time in paused state, navigation between notifications and activities is still bit messy and few more issues), but generally it works. Continue reading audioserve Android Client Early Beta Is Available
As part of audioserve project I decided to create an Android client. To make this exercise more interesting I decided to write it in Kotlin language (see previous article about Kotlin language). This client should provide roughly similar interface as web client (see this article for web client interface demo), but I hoped to achieve much better caching features, which will enable to play smoothly even when connectivity is temporarily lost ( for half an hour, an hour) and possibility to download and play audiobooks completely offline. Further in this article I’d like to share my experiences with Android development, as beginner in this area. And spoiler is I do not like it. Continue reading Stupidly Complex or Completely Stupid – Android Development
One may think that we have already more then enough programming languages. But community thinks differently and new languages keeps popping up and thanks for that, because some bring cool innovative features, others focus on more streamlined and effective development, but all of them contribute to the evolution of the IT industry. Because as in the nature progress comes through the variety of species and competition between them. As I have written in my past article I looked recently into Rust language – very interesting language, which comes with novel approach to memory management without garbage collection, but still assuring high security of the program. Nowadays I met another member of ever-growing happy family of programing languages – Kotlin and I’d like to share my first experiences in this article. Continue reading From Russia with Love – Kotlin Language