Paolo Bonzini's blog
Floating point to decimal conversion is not so easy
Russ Cox of Plan-9 and Go fame posted a blog entry titled Floating Point to Decimal Conversion is Easy. While he is usually right, I believe this time he isn't.
Floating point to decimal conversion is easy if you are okay with ugly results. A good conversion routine will print the shortest decimal representation of the floating-point number, that is, the shortest decimal number whose closest floating-point representation equals the original number. You do not want 0.30000000001, you want 0.3, because the number right above 0.3 is 0.30000000003 and 0.30000000001 does not provide any extra precision.
Towards a permissive copyleft license for dynamic languages
The problem
With the recent increase in free-software releases for dynamic languages, a serious issue is there for people who would prefer to give their software the protection of copyleft. The issue is the difficulty of interpreting the Lesser GPL in the context of these languages.
The difficulties in turn from two different sources. First, it is hard to interpret the language of the Lesser GPL in the context of languages that have no object files but only source code files.
All you should really know about Autoconf and Automake
So, here is the shortest possible tutorial on the autotools.
The problem with autotools is that it is used for complicated things, and people cut-and-paste complicated things even when they ought to be simple. 99% of people just need a way to access .pc files and generate juicy Makefiles; the portability part is taken care by glib, sdl and so on.
You can use then the following basic autotools setup, which is just 9 lines. You can start from here and add more stuff (including libtool).
- configure.ac:
AC_INIT([package], [version]) AM_INIT_AUTOMAKE([foreign subdir-objects])
Optimizing HTTP header manipulation, part 2
In the previous post I told you how a couple of primitives (which means, modifications to the base classes) helped speeding up HTTP processing in Swazoo by a factor of 6.
Today I'll remove another part of it by modifying Swazoo itself. To remove Seaside, I used the simple "hello world" site that Swazoo serves if you start it with
gst-load --start=swazoodemo Swazoo
Optimizing stream operations
One of the improvements in GNU Smalltalk 3.1 was the optimization of block operations on Streams. Basically, methods such as #next: and #nextPutAll: were rewritten to use fast collection operations instead of copying data element by element to the stream. Since #replaceFrom:to:with:startingAt: (the basic Smalltalk "move" operation) ultimately boils down to a memmove call, this is extremely fast.
But was this the end of the story? Today, after getting some inspiration from Nicolas Petton, I decided to try profiling Seaside and Swazoo.
