After reading Daniel Stenberg's post on case-insensitive string comparison in cURL, I decided to take a stab at implementing something like this in Lwan for the same reasons. (Lwan used to use strcasecmp() before using the one described in this blog post.) Published September, 15
It's been a while since I've blogged about the JSON library optimization work I did for Lwan's entry in the TechEmpower Web Framework Benchmarks. I've been taking a break from a lot of my personal projects, so the work to generate machine code from the… Published May, 23
Out of the many benefits of HTTP/2 is its ability to not waste bandwidth with headers when compared to HTTP/1.1. This is achieved by doing three things: Published March, 27
One of the long standing tasks in Lwan is to implement HTTP/2. I've been postponing it since before it was fully standardized, and followed a lot of public discussions that turned SPDY into HTTP/2. I had a few false starts, but never really started the… Published March, 23
A few weekends ago, I decided to break my hiatus of recreational programming and play a bit with Serenity OS. What I decided to play with was the SoundPlayer application, to avoid working on the kind of stuff that I'm usually drawn to – and learn a few… Published October, 06
A while back I opened an online form so that people could ask me anonymous questions, and posted it on Twitter. Then I forgot about it – until today, when I was cleaning up my online docs, and saw quite a few questions there, waiting to be answered. Oops! Published March, 06
Right after the BUILD conference, Microsoft released the source code for the first version of GW-BASIC for the MS-DOS under the MIT license. Not only this is an improved version of the very first product that kickstarted the company, it's also the base… Published June, 21
A few years back, I wrote a tiny JSON library for the Zephyr OS; it focused mostly in things that are important for an embedded real-time operating system: code size, type-safety, and predictability (both for memory and CPU time usage). It was never tuned… Published February, 10
Around five years ago, I wrote a blog post that went though the life-cycle of a HTTP request, as seen by my toy web server, Lwan. It was a surprisingly popular article, not only raising visibility for my toy project, but also generating some discussions… Published October, 24
One of the decisions I took early on while writing Lwan was to only support Linux, and think about portability later; this decision was influenced by the way the OpenBSD project approaches portability. Published June, 28
My laptop is a 6-year old ThinkPad X220. Although it's almost falling apart from years of constant abuse, I don't see myself replacing it anytime soon: it's easy to repair, has a great keyboard, and is a very dependable machine. Published May, 08
There are many libraries out there to parse JSON files. It might be a futile attempt, then, to write yet another one. However, when you're working on a RTOS where memory is golden, and the alternatives don't look that great, you got to do something about… Published March, 01
I’m not one to jump on each and every bandwagon I see. Sometimes that’s a good decision, sometimes it’s better to just wait and see where they go before taking any action. Published November, 08
I've been thinking for a while on how to reduce the overhead in Lwan's string buffer, when the strings are small. There are a number of ways of accomplishing this. Published November, 02
When learning a new programming language, I tend to write two things with it: a language interpreter (usually a FORTH-like language or Brainfuck if I'm feeling lazy), and a HTTP server. Sometimes, just as a challenge or a way to quench my boredom, I do… Published October, 06
There are various ways to convert integers to their string representation. These conversions are rarely a bottleneck, but they often show up while profiling certain applications. For instance, they're very common in Lwan while building the response… Published June, 23
One of the things that bothers me when I'm writing software is that I never get things right the first time. It takes me quite a few iterations to achieve a good result -- be it performance, memory usage, or a good architecture. Getting things to a "good… Published December, 08
When I wrote about lwan's templating engine on a blog post last year, I purposedly ommitted the fact that it didn't support sequences. Took me almost a year, but I've finally implemented it this week. (Lwan is usually a low priority weekend project. Maybe… Published September, 26
There are some functions in the standard C library that takes a function pointer to be used as a callback later on. Examples include atexit() and signal(). However, these functions can't receive an arbitrary pointer (which could hold some important… Published July, 20
Generating textual output is a lot easier with templates than it is with handcrafted functions. And it is a lot easier in languages such as Python, where things like introspection are easy and cheap. But that doesn’t necessarily mean we can’t do that in C… Published November, 11
I’ve attended this year’s FISL, both as a booth attendee (at ProFUSION’s booth, demonstrating a few of our end-user-visible projects), and as a speaker for my old FINF project. Published October, 27
Previously, I’ve improved file serving performance in lwan by dramatially cutting down on the number of system calls performed to serve a file. However, for small files (< 16KiB), the throughput drop from the hello handler (which merely responds “Hello,… Published October, 14
Writing asynchronous I/O code in C is kind of tedious, and often leads to a callback hell. But it doesn’t have to be this way; if you have a main loop, it’s quite simple to use coroutines and write code in a soothing, old school, synchronous way. Published September, 29
I’ve been working at ProFUSION on a project called EasyUI for the past few months. This library is based on Google’s V8 JavaScript engine and the Enlightenment Foundation Libraries and aims to diminish the hurdle in writing native applications for the… Published September, 21
When I first wrote lwan, file serving was not a primary goal. I’ve added this capability later, never giving much thought to the number of system calls required to serve one file. As a result, static file serving was quite slow compared to “hello world”… Published August, 12
Golang has a lot of nice features – and one I found pretty interesting is called deferred statements. This can be implemented in C++ pretty easily through RAII, but in C we’re pretty much out of luck. Or are we? Published August, 11
Tries are very useful data structures if you need to perform longest subprefix matching. Unfortunately, simple implementations uses a lot of memory, which is often solved by collapsing common prefixes in a single node (like a Radix tree). However, this… Published August, 10
C’s switch statement is very powerful. However, it can’t be used with strings, only with constant integral types. This is understandable, since strings in C are merely arrays – they’re not first-class citizens. Published August, 09
Last week I was in Belgium, attending the Free and Open Source Developers European Meeting — FOSDEM, for short. This conference is held every year and gathers people from all around the globe to discuss and publish FOSS-related matters. Belgian beer,… Published February, 13