Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jplindstrom (594)

  (email not shown publicly)

Journal of jplindstrom (594)

Tuesday January 14, 2003
08:46 PM

C -> Perl

[ #9977 ]

This afternoon, in order to add a little functionality, I re-implemented a small server program (basically just extracting and serving log files), written in C.

Before: 750 lines, 25K
After: 150 lines, 6K

Had I not been forced to follow a home grown protocol it would have been smaller and gone quicker (HTTP::Daemon and all).

Why do people keep writing their own protocols when there are existing protocols with existing implementations that work just as fine? This protocol was stateful when it didn't need to be, so HTTP would have worked nicely.

One thing I noticed and appreciated is that Perl's old inheritance from C with identical networking commands got the IPC code real easy to port from C.

A 5:1 code size ratio seems a bit large even for C vs Perl, and admittedly it wasn't the tightest C code I've seen.

In another C-program I re-wrote in Perl (the original never got stable, so we got tired of cleaning up the mess it left behind) the lines-of-code ratio was something like 3:1, with a bit more functionality and a lot more stability in the Perl version. That, and unit tests.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.