The problem with event loops
There are a number of surface reasons why programming in an event loopparadigm is a pain in the ass; anyone who has ever done it can probablyreel off a litany of complaints for you. I maintain, however, that manycome down to a single fundamental issue. In a nutshell, event loopsmake you manage execution context manually, by yourself .
As I mentioned in my entry on event loops versus threads , both event loops and threads are switchingcontexts back and forth; it's just that threads do
The true cost of sysadmin time (actually, of anyone's time)
Here's a question for you: what's the cost to the organization of havinga sysadmin spend an hour sorting out a user's problem? At one level theanswer is straightforward; you take the sysadmin's fully loaded salary,work out the equivalent hourly wage, and say that that's the cost.
But this is too narrow a view. In most places sysadmins don't haveidle time; there is always something that they could be doing (eithercurrently needed work or long
Why people are attracted to minimal language cores
In the last entry I described how some languagesrewrite loops with loop bodies by turning the loop body into ananonymous function that the loop invokes repeatedly. I then mentionedthat some languages go all the way to turning loops into tail-recursivefunction calls. You might wonder why languages do this and why thesesort of crazy transformations are considered attractive.
There are at least two reasons that these things are popular, for somedefinition of popular. First, the intellectual purity of a minimalcore language appeals to a certain sort
Arranging scopes for for loops
Suppose that you have a language where for loop index variables arelocal to the for loop; they aren't visible outside it. What I'llcall the 'for loop closure problem' is that in a straightforwardimplementation of their lifetime, the following pseudo-code doesn't workthe way people think it will:
nums := [];for (var i = 0; i < 100; i++) nums.append(func(x) {i+x}My view of the state of graphics cards for Linux (in fall 2011)
I sort of alluded to the state of graphics cards for Linux in passing in my hardware spec list , so I want to write it downexplicitly in more length (if only so that I can point to this later).
There are at the moment three main sources of decent PC graphics:Intel, nVidia, and ATI (now part of AMD). ATI and nVidia make bothgraphics cards and integrated graphics chipsets; Intel only makesintegrated graphics (very integrated these days, as they are nowpart of the
My new Linux machine for fall 2011 (planned)
My current home machine turned five years old a couple of weeks ago,so it seems like about time for for me to get serious about puttingtogether a new one. It helps that I've been mulling this over for some time ; it also helps that new software is making the my current machine feel increasinglyslow, which certainly adds motivation. As a result of this I wasexplaining my hardware choices to someone online, so I figure that Imight as well recycle what I said as an entry.
I
Python's philosophy of what closures close over
A commentator on my last entry on closures said:
I don't not fully understand why closures could not capture bindingsupon being defined, though: [...]
As your first example shows, this is what many people intuitivelyexpect, it seems. So, do you know why this behavior was not chosen?
I think the real answer is 'because how Python does it is how languagesusually do it'. Let me elaborate on that.
When you add closures to a language, you are faced
Thinking about event loops versus threads
The inimitable Ted Dziuba recently compared threadsagainst event loops for throughput and ease of use and came down firmlyon the side of threads; to summarize his writing, he argues (with math)that threads have the same throughput and are easier to use. While Isort of agree with this, I think that his math makes some assumptionsor, alternately, ignores some constant factors that are potentiallyimportant in real life.
(His math implicitly assumes that servicing activity either takes thesame amount of CPU in threads as it
Understanding the motivations of mail service vendors
From a comment on my entry about how modern mailing services shouldwork :
Like any paid service, if they are not providing good service, likeletting spam through, people will move to another one who does blockspam better. This is their incentive to deal with spam.
This is a common misunderstanding of the incentive structure inoperation.
This is not an incentive to deal with spam, this is an incentive tonot get blocked. The two are very much not the same thing. Very fewpeople who use a
On CPython, cell objects, and closures
A commentator on Understanding a tricky bit of Python generators noticed an odd looking thing with generatorexpressions:
adders = list(lambda x: x+i for i in range(0, 100))
print adders[17](42)
This prints '141'. On the one hand this is quite ordinary (it's justlike other cases of lambdas), but on the other hand things start lookingquite peculiar when you disassemble the generated bytecode for thelambda expressions and