mike watkins dot ca : June 2009 Archives

June 2009 Archives

3 entries filed this month:

June 29 2009

New and Improved - Python 3.1

Updated to include a comparison to Python 2.5

Python 3.1 has closed much of the performance gap between 3.x and 2.x, as well as delivering some new features and enhancements to the language and stdlib. Enhancement that caught my eye first: re.sub | re.subn | re.split now accept a flags parameter, no more remembering how to pass that in as part of the regex. And I think I'm going to like auto numbered format() fields i.e. 'We are the {} who say {}'.format('Knights', 'Ni!').

On first blush it may not seem that the performance gap has been closed very much. A simplistic web app benchmark:

siege -b -t60s -c2  http://localhost:8000/

Old machine (light mail server load / FreeBSD 7.2)
Python 2.6     520.91 trans/sec
Python 3.1     388.38 trans/sec

Newer Virtual Machine (moderately loaded server / FreeBSD 7.2)
Python 2.6   1568.58 trans/sec
Python 3.1    1220.92 trans/sec

Faster Virtual Machine (quiet server / Debian 5 - OpenVZ)
Python 2.5    2304.78 trans/sec [1]
Python 3.1    1960.07 trans/sec

Looking deeper, I'm seeing little difference between 2.6 and 3.1, here benchmarking a more involved web app benchmark than "hello world" that is probably more representative of a typical yet simple web app:

siege -b -t60s -c2  http://localhost:8002/

Old machine (light mail server load / FreeBSD 7.2)
Python 2.6    197.40 trans/sec
Python 3.1    194.09 trans/sec

Newer Virtual Machine (moderately loaded server / FreeBSD 7.2)
Python 2.6    649.57 trans/sec
Python 3.1    629.50 trans/sec

Faster Virtual Machine (quiet server / Debian 5 - OpenVZ)
Python 2.5    765.88 trans/sec
Python 3.1    850.24 trans/sec

[1] Note Python 2.5 being compared in this test instance

From what I can tell, for the sorts of tasks I run into, Python 3.1 appears to perform as well or better than Python 2.5 and is approaching the current speed daemon, Python 2.6. Take that with a grain of salt, as I found 3.0 was fast enough for my needs.

June 22 2009

Democracy Sliced and Diced

One of Canada's keen observers of our decaying democracy, journalist James Travers in Saturday's Toronto Star announced a new series on that very subject, building on an article penned this spring on what he termed the quiet unravelling of Canadian democracy.

Incrementally and by stealth, Canada has become a situational democracy. What matters now is what works. Precedents, procedures and even laws have given way to the political doctrine of expediency. James Travers, April 2009

There is a good deal to say on this subject, but I wonder if Canadians will bother listening. Few seem to realize exactly what we are losing year by year, government by government. The attack on Canada's democratic system is no benign tumour but a systemic disease. The symptoms are in plain sight--always have been, yet few seem alert to the disease which slowly is enveloping our society.

Travers noted the last parliamentary session saw:

  • Parliament lost more of its defining control over the public purse when the Prime Minister slipped $3 billion in public spending behind closed cabinet doors.
  • Oversight was blinkered again this week when the new federal budget office was denied the independence needed to probe and explain how Ottawa spends.
  • Voters' control over their elected representatives was again eroded when Liberals, like Conservatives, saved obedient incumbent MPs from the discipline and inconvenience of nomination contests.
  • Power is sliding farther away from the Commons and cabinet to concentrate in the Prime Minister's Office as a presidential-style spokesman increasingly becomes the administration's public voice.

Expediency, in the quest for power, is the name of the cancer which afflicts our democracy.

This spring the government's own Information Commissioner chastised the government for perpetuating a cult of secrecy, for openness is the cure-all for political expediency that recent Liberal and Conservative governments alike have avoided like vampires to garlic.

With an obviously crumbling economy looming, threatening Stephen Harper's hold on power above all else, it was expediency at work as we witnessed a Prime Minister break his own law (fixed election dates) and then during what could only be seen, morally, as an illegitimate election, Stephen Harper would lie through word play and omission to the public about the state of Canada's economy.

One doesn't have to look very hard for more symptoms of Canada's democratic decay. Once touted as a grass-roots movement led by "conservative" reformers -- one member, one vote, implying that everyone's voice mattered -- Conservative party members have long since lost any real voice, relegated to irrelevance as the only opinion in that party which matters is Stephen Harper's. Ideological Conservatives long decried what they saw as a Liberal invention - the "nanny state", but they have fostered something much worse - the "daddy state" where Harper knows best. Only because of an expedient lust for power, or lack of common sense, have those party supporters kept silent.

The grass is not greener on the red side of the fence. Liberals having elected Dion as a different kind of leader not soon after decided to expeditiously punt him without benefit of a democratic replacement. When opposition parties had the opportunity to defeat the government and form a government by coalition, key Liberals stood silent while the media more or less partnered with Harper and his minions to twist the situation in front of a Canadian public whose senses have long been dulled. It's "un-democratic" the Conservatives bleated and brayed, when in fact a coalition government is anything but, and many Liberals, and most of the press, sat back and let events unfold.

In other countries many fight to their death in the faint hope of ever seeing something resembling democracy grace their lands, while we do nothing as one of the world's truly great democracies slowly atrophies as the cancer ravaging our democratic system courses through our politics while calculating politicians on both sides of the house sit mute and idle.

Is it our fate that Canadians be engaged in nothing more but complacent servitude to a system in which we really have no voice nor control? If we do not, our children's children will one day wake up as indentured servants of some oligarch with powers not unlike the feudal lords of old. Some might argue we are all but there now.

Maintaining a vibrant democracy is hard work that we must all shoulder some of the burden of building and repairing.

Travers' last line of his April article on democracy is perhaps the most pertinent:

If war is too serious to leave to generals, then surely democracy is too important to delegate to politicians.

June 14 2009

It's Alive

Gosh, has it been three months since I posted last? House renos are coming along, but it only gets worse from here before it gets better. We'll be cooking on the patio soon enough.

Semi-random tech link of the day: FreeBSD ports now default to Python 2.6. Yay. You could always force FreeBSD to use a specific Python version -- edit /etc/make.conf and add the line PYTHON_DEFAULT_VERSION=python2.6 or whatever version you like.

I smell a skunk nearby. No, really, they like to walk down the sidewalk past my office window. Unpleasant, but not nearly as bad as having them spray the house. And this leads me to the skunk control tip of the day: do not try to dissuade two skunks from fighting at 2am in the morning below your kitchen window by throwing water at them.