I broke The Protocol Stack From Hell™. Again. It's a common
occurance whenever I attempt to run a load test (nominally against our own
code, but it has to run through The Protocol Stack From Hell™ and
well, The Protocol Stack From Hell™ just tends to crumple). It's not
fatal, just a severe annoyance at having to restart everything and hope it
all comes back up.

I talked to R about this, seeing how he has over twenty years of
experience with telephony protocols. I mentioned just how bad The Protocol
Stack From Hell™ is, and ask if there was anything
better.

I was informed that most of the major telephony players, like AT&T, wrote their own stack, but there do exist two
commercial offerings, one being The Protocol Stack From Hell™ that I
keep going on and on about. The other one …

The conversion string is fixed, but that doesn't preclude a port to, say,
an EBCIDIC system
from using a different one, or the string being constructed at run time.
The runtime generation would be more portable, but to me, that's wasted time
spent generating a string that will always be the same (and frankly, if
we're using this hack for speed, that's just wasted time).

Perhaps better might be several such strings, ASCII,
EBCIDIC,
Baudot, PETSCII
and select via a command line option which one to use (defaulting to
whatever character set is native for the platform the program is running
on). It could be a useful thing.

But such a modification I'm leaving as an exercise for the reader.

Now, is this the fastest version possible? I'm not going to say
yes this time. There might be something else that could be done to wring
that last bit of performance out of this code, but at this point, I am
definitely done with wringing out the speed.

Jeff
Cuscutis sent in a version written in C♯ (C-sharp, in case you
don't have a font with the sharp symbol). He assured me the code works, but
I can't test it as I don't use Microsoft Windows; nor have I installed Mono, as I don't
really have a need to interoperate with the Microsoft Windows environment
(at home, or at The Corporation).

Now, is this the fastest version possible? I'm not
going to say yes this time. There might be something else that
could be done to wring that last bit of performance out of this
code, but at this point, I am definitely done with wringing out the
speed.

That didn't prevent Dave Täht from sending in a
patch to part 24 that used mmap() (a system call that does some
magic to make a file suddenly appear in memory) which did better on his
system, although it was a percentage gain, not an order of magnitude
gain.

I tried it on my system, and saw no difference in performance whatsoever.
But Dave was using a 64-bit system, and I was using a 32-bit system. Okay,
there could be a difference there. I then tried it on a 64-bit system (The
Corporation provided laptop, running a 64-bit version of Linux) and there
was a difference, but well:

Yes, time spent in the kernel goes down (understandable, since we no
longer have to copy data out of the file through the kernel) but the overall
time goes up. And at this point, we've reached the point of diminishing
returns, where the amount of return does not justify the amount of
effort. It could be that Dave's machine had more memory than my machine, or
a faster harddrive, or a later version of the kernel that handled
mmap()/madvise() better. There's no real gains at this point
to be had.

Another interesting thing is to run the time command, but with more verbose
output:

The number of page faults skyrockets to 185,449, three orders of
magnitude more than the previous version, and thus, that could account for
the time loss on my 64-bit system (quite possibly this does show a
sub-optimal implementation of mmap()).

Actually, the vowel impairmentvwlmprmnt code was
due to linker strictions at the time—linkers at the time were fairly
limited, and one of the limits was the length of identifiers it could
handle, a limit of around 6 characters (some might have handled more, but
the first C standard in 1989 set the limit to six, so that's probably the
smallest size at the time). With only six characters (makes you wonder
where that limit comes from)
and vowels typically being redundant (“f y cn rd ths y t cn wrt prgrms”)
is it any wonder early code was typically vwlmprd?

I suspect that many entries in the IOCCC start out as normal, are converted to K&R as a first step, then rename all variables
and functions to one or two character names and unneeded spaces removed.

Much like today's version.

/*************************************************************************
*
* Copyright 2012 by Sean Conner. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Comments, questions and criticisms can be sent to: sean@conman.org
*
*************************************************************************/
/* Style: K&R, system calls, full buffering, obfuscated */
#include <errno.h>
#include <fcntl.h>
main(a,b)char**b;{int i,f;if(a==1)fa(0,1);else{for(i=1;i<a;i++){f=open
(b[i],O_RDONLY);if(f==-1){fd(b[i]);continue;}ff(1,"-----",5);ff(1,b[i],
strlen(b[i]));ff(1,"-----\n",6);fa(f,1);if(close(f)<0)fd(b[i]);}}return 0;}
char a[4096],b[75*109];
fa(c,d){int e,f,g,h;char*i,*p;memset(b,' ',sizeof(b));e=g=0;i=b;
while((f=fe(c,(char *)a,sizeof(a)))>0){p=a;for(p=a;f>0;){h=fb(&i,p,f,e);
p+=h;f-=h;e+=h;g++;if(g==109){ff(d,b,i-b);memset(b,' ',sizeof(b));g=0;
i=b;}}}if (i-b>0)ff(d,b,i-b);}
fb(a,p,c,d)char**a,*p;{char*e,*f,*g;int h;e=*a;fc(e,d,8,':');if(c>16)
{c=16;}p+=c;f=&e[10+c*3];g=&e[58+c];for(h=0;h<c;h++){p--;g--;f-=3;
if((*p>=' ')&&(*p<='~'))*g=*p;else*g = '.';fc(f,*p,2,' ');}e[58+h]='\n';
*a=&e[59+h];return h;}
fc(a,b,c,d)char*a;{a[c]=d;while(c--){a[c]=
(b&0x0F)+'0';if(a[c]>'9')a[c]+=7;b>>=4;}}
fd(a)char*a;{extern char**sys_errlist;extern int sys_nerr;int b=errno;
ff(2,a,strlen(a));ff(2,": ",2);if(b>sys_nerr){ff(2,"(unknown)",9);}else
{ff(2,sys_errlist[b],strlen(sys_errlist[b]));}ff(2,"\n",1);}
fe(a,b,c)char*b;{int d=0,e;while(c>0){e=read(a,b,c);if(e<0){fd("read()");
exit(1);}if(e==0){break;}d+=e;c-=e;b+=e;}return d;}
ff(a,b,c)char*b;{if(write(a,b,c)<c){if(a!=2){fd("output");}exit(1);}}

And here we have a fully obfuscated version of our program—a nearly impenetrable wall of
characters that nonetheless compiles and works.

/*************************************************************************
*
* Copyright 2012 by Sean Conner. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Comments, questions and criticisms can be sent to: sean@conman.org
*
*************************************************************************/
/* Style: K&R, system calls, full buffering, obfuscated 2 */
#include <errno.h>
#include <fcntl.h>
main(a,b)char **b;{int i,f;if(a==1)fa(0,1);else{for(i=1;i<a;i++){f=open(b[i],
O_RDONLY);if(f==-1){fd(b[i]);continue;}ff(1,"-----",5);ff(1,b[i],strlen(b[i])
);ff(1,"-----\n",6);fa(f,1);if(close(f)<0)fd(b[i]);}}return 0;}char a[4096],b
[75*109];fa(c,d){int e,f,g,h;char*i,*p;memset(b,' ',sizeof(b));e=g=0;i=b;while
((f=fe(c,(char *)a,sizeof(a)))>0){p=a;for(p=a;f>0;){h=fb(&i,p,f,e);p+=h;f-=h;
e+=h;g++;if(g==109){ff(d,b,i-b);memset(b,' ',sizeof(b));g=0;i=b;}}}if (i-b>0)
ff(d,b,i-b);}fb(a,p,c,d)char**a,*p;{char*e,*f,*g;int h;e=*a;fc(e,d,8,':');if(
c>16){c=16;}p+=c;f=&e[10+c*3];g=&e[58+c];for(h=0;h<c;h++){p--;g--;f-=3;if((*p
>=' ')&&(*p<='~'))*g=*p;else*g = '.';fc(f,*p,2,' ');}e[58+h]='\n';*a=&e[59+h]
;return h;}fc(a,b,c,d)char*a;{a[c]=d;while(c--){a[c]=(b&0x0F)+'0';if(a[c]>'9'
)a[c]+=7;b>>=4;}}fd(a)char*a;{extern char**sys_errlist;extern int sys_nerr;int
b=errno;ff(2,a,strlen(a));ff(2,": ",2);if(b>sys_nerr){ff(2,"(unknown)",9);}
else{ff(2,sys_errlist[b],strlen(sys_errlist[b]));}ff(2,"\n",1);}fe(a,b,c)char
*b;{int d=0,e;while(c>0){e=read(a,b,c);if(e<0){fd("read()");exit(1);}if(e==0)
{break;}d+=e;c-=e;b+=e;}return d;}ff(a,b,c)char*b;{if(write(a,b,c)<c){if(a!=2
){fd("output");}exit(1);}}

Yesterday's version is the last
version I'll be posting for now. When I was initially inspired, I ripped
through a majority of what you've seen in just three days. It's not really
surprising given that a majority of the “variations” differed by a line or
two of code.

But I've run out. And now, having done 21 variations in C (one more than I originally planned),
five in Lua (I could do one more in Lua—the actual original code I based
the Lua versions off of, but oddly enough, it doesn't actually handle
files), two in a dialect of BASIC I can't currently test and two I didn't
expect in C♯ (both submitted by Jeff Cuscutis), I don't think I
have it in me to do many more.

I've exhausted C. And I pretty much exhausted Lua, which are my two “go to” languages
these days. I could probably push out a couple of Perl versions, and a PHP version (PHP does not have nearly the
expressiveness of Lua or even Perl to bother with more than one version)
but that's about the limit.

There are a few other languages I could do (Common Lisp, Scheme, SNOBOL (seriously!), Forth, Awk, Erlang, Python and Ruby) but those would
require significant time hitting up documentation and what not because I
don't know those langauges all that well (if at all).

So I'll probably continue this series, but it'll probably be a post or
two every few months and not every XXXXXXX
day as I have been doing.

I made a comment recommending against using “the cloud” to store your
data on GoogleFacePlusBook and someone took offense to that remark. I know, I know, but in my
defense, we were both in the wrong, and in the end I hope we all
learned something. I learned that “buying a book” is more “licensing to
read” than actual ownership (even the dead tree type, and this from a
lawyer I called (and if I knew his website, I would link to it here)) and
the other person learned that yes,
Virginia, you can successfully sue Amazon for having eaten your
homework.

I still stand on my original remark, not to use “the cloud” to store
your data. To present your data (like pictures, idiotic blog posts, what
have you) to the public, sure, use “the cloud.” To store your data (or
even a backup of your data)? Not on your life.

But it didn't occure to me that a company hosting “the cloud” could
concievably mine your own data—I mean, it's there, right? And
then I read this little gem of an article:

… Target has a baby-shower registry, and Pole started there,
observing how shopping habits changed as a woman approached her due
date, which women on the registry had willingly disclosed. He ran
test after test, analyzing the data, and before long some useful
patterns emerged. …

…

About a year after Pole created his pregnancy-prediction model, a
man walked into a Target outside Minneapolis and demanded to see the
manager. He was clutching coupons that had been sent to his
daughter, and he was angry, according to an employee who
participated in the conversation.

“My daughter got this in the mail!” he said. “She's still in
high school, and you're sending her coupons for baby clothes and
cribs? Are you trying to encourage her to get pregnant?”

The manager didn't have any idea what the man was talking about.
He looked at the mailer. Sure enough, it was addressed to the man's
daughter and contained advertisements for maternity clothing,
nursery furniture and pictures of smiling infants. The manager
apologized and then called a few days later to apologize again.

On the phone, though, the father was somewhat abashed. “I had a
talk with my daughter,” he said. “It turns out there's been some
activities in my house I haven't been completely aware of. She's due
in August. I owe you an apology.”

Update a few minutes later

Okay, let me see if I have the pitch right—hypothetically speaking,
let's say I have made, through many illegal means, a metric buttload of
money and I want to have it laundered. I don't want to mess with the
banking systems as they seem to be under high scrutiny these days (besides,
everybody knows they're criminals anyway).

So, I grab a few hundred pages from Wikipedia, bundle them into a “book”
which I “publish
and sell” via Amazon. This costs me nearly nothing.
Then I “buy” as many copies of this “book”, getting nearly 45% of the
money as the “author.” Amazon won't complain, as they're getting a nice
chunk of change. Heck, I could even get a higher percentage of the money if
the “book” is bought through an affiliate program I set up
(this might push my percentage over 50%).

Obligatory Miscellaneous

You have my permission to link freely to any entry here. Go
ahead, I won't bite. I promise.

The dates are the permanent links to that day's entries (or
entry, if there is only one entry). The titles are the permanent
links to that entry only. The format for the links are
simple: Start with the base link for this site: http://boston.conman.org/, then add the date you are
interested in, say 2000/08/01,
so that would make the final URL:

You may also note subtle shading of the links and that's
intentional: the “closer” the link is (relative to the
page) the “brighter” it appears. It's an experiment in
using color shading to denote the distance a link is from here. If
you don't notice it, don't worry; it's not all that
important.

It is assumed that every brand name, slogan, corporate name,
symbol, design element, et cetera mentioned in these pages is a
protected and/or trademarked entity, the sole property of its
owner(s), and acknowledgement of this status is implied.