Our Project: Backseat Casting

Our project: Backseat Casting

Mei Lu had a great idea for a fun social networking app.  She presented her idea well:

Tom Hanks shouldn’t have been cast as Dr. Langston in The Da Vinci Code movie.

Who would have done better?

It’s a simple parlor game that everyone has played.  If they made your favorite book into a movie, who would you pick, if you were the casting director (and money was no object.)  Alternately, who would be better cast in an existing movie.  Either originally or as a remake.  You could go for serious or funny answers.

Mei’s idea was a simple website where people could make suggestions and vote.  A brilliant idea, potentially ad driven, taking advantage of the viral marketing of social networks,

My contribution was the idea that you could use twitter as a user interface.  Just tweet your vote with a hashtag to facilitate search:

#backseatcasting Antonio Banderas as Inigo Montoya in The Princess Bride.

People could either use the web, or even twitter to follow others’ choices.  And of course, there would be a Facebook app.

I also thought of a variation.  Another parlor game I like to play with my wife while driving:

Worst Cover Song (or Worst Duet)

#worstcoversong Billy Corgan singing Hit Me Baby One More Time by Brittany Spears

The great part about using twitter as a UI is you can go live almost immediately.
backseatcasting_twitter
We had a great team, even though we started out small (just 3 of us), but we grew as the weekend progressed.  It really was starting to come together, despite the technical difficulties.

I didn’t go on Sunday, so I missed our presentation and maybe hurt the team a little.

Our first decision was to go with .NET and Silverlight – technologies I know nothing about, but our only other developer, Jayhen, knew them well, and he was probably a better programmer than me.  But we ran into a snag when we couldn’t get hosting, the domain, or development tools set up, so we improvised mid-stream and I set up a QA Site with MySQL and PHP/Ruby.

Our next hurdle was migrating a SQL Server schema to MySQL and getting the database driver working in .NET.  That lost us valuable time.  Eventually, they switched back to SQL Server, but unfortunately I think there ended up being no  working UI or live site for the demo.  I don’t know how the sample data went, but we had a good start.

Lisa, our business girl, was up running creating a Silverlight user interface with MS Expression, and I worked on graphic design, and created a HTML site with a PHP template that we could drop our Silverlight controls into, as well as helping out with the database and our backup Linux environment.

Another programmer joined us (sorry, I forgot his name) and took over rapidly building the twitter API functionality I’d wanted but hadn’t got to yet.

The environment troubles and brutally unreliable internet (until I got plugged into a hub (as well as for me personally) having to use my piece of junk laptop – that’s right — I did some graphic design in MS Paint (because Gimp couldn’t cut and paste) with a broken mouse pad.  Still, not too bad, if I do say so myself

backseatcasting.qa-site.com-screenshot

They ended up cutting out my UI as well, but c’est la vie.

backseatcasting.com-screenshot
I had a great time, and I’d love to see the project keep going.  I’ll still tweet my casting decisions from time to time if nothing else.

I also intend to develop my goal tracker widget as well, possibly with a twitter UI.

And I’m going to build a generalized twitter vote tallying app, too.  Twitter @tvotes or @tpolls go to http://tvotes.net or http://twitterpoll.biz.

With all these ideas (and more), I just hope I can maintain a fraction of the momentum I had at startupweekend.  I have another idea for that.  I’m going to start a blog and call it either “In one week” or “Done in one”.

The idea being to use the microsprint format to get working prototypes done in one week.  An initial idea could be pitched as a submission.  Readers could vote on it, either conceptually, or as a participant.  Once a project is green-lighted, teams will have 1 week to develop a prototype.  Then, potential users, customers, or investors could review it and they decide whether they pursue it further, or try again with something new.  Hopefully, I’ll get some of them to post lessons learned as well.

after Startup Weekend

Friday night I went to Startupweekend and pitched my idea for goal widgets.  I ended up working on another project, but a few people did show interest.

I had planned on essentially reciting my blog post pitch, cutting it to about 5 minutes with time for audience feedback.   I rehearsed it a few times, and had gotten it down to 7 minutes.  I put the whole talk on 13 index cards and wrote the first sentence on the back of each.  That turned out to be a good system, because if I read each opening sentence, it was still a coherent (if unpursuasive) talk.

But I found we’d only be allotted 1 or 2 minutes.  So I’d cut the part about myself, some of the details about implementation, shorten the user cases, and skip most of the social network prelude.  But, I ended up butchering it anyway.

So much for my public speaking skills.  I think it actually shows promise for the idea itself that anyone had interest.  Several people mentioned that they’d read my blog post or my comment in response to someone else’s post

Startupweekend was held at Microsoft in Redmond, sponsored by the BizSpark team.  I’d guess about half of the people there were Microsoft employees, and there were only a few Macs on site and even fewer designers.  (I even did double duty as a designer.)

It was a great idea, I had some good opportunities to network, and the energy there was fantastic.

What made Startupweekend work?  I think a several things were critical to the success, and a few things that could be done better.

First the good:

Deadlines. Such a short time frame forces you to focus.  You have to make decisions quick and you have to prioritize.  I think in many cases (especially the trivial ones) you make better decisions if you make them quicker.  Dwelling on alternatives just confuses the issue.

We had some technical issues, and made some quick decisions for workarounds that may have hurt our productivity, but overall, the very short deadline was a huge positive.  Three full days might have been ideal, especially if the environment issues had been worked out.

Team. Working together as a team has a great multiplying effect.  Everyone has said it before, but it’s true.  A small group of self-selected individuals can do amazing things in a short time.  The ability to bounce ideas off of one another, and to help each other stay focused is priceless.  We started out with a

Change of Environment. Getting out of your routine & comfort zone, going someplace new, working with new people has a much larger impact than you’d think.  Whatever handicaps were added by the environment (and there were plenty) were more than compensated by the fresh perspective it gave (under the dull neon lighting, no less.)

There were some challenges, as I’ve already alluded to, but nothing really deletrious.  Mainly centered around organization and planning, but it was better to do it poorly than not do it at all.

I have no complaints, but sadly, I’d say the weakest link in the whole weekend was from the host and sponsors.  I’m grateful to Microsoft Bizspark for hosting, but this is what I think could have been done better:

Agenda and Announcements. The whole agenda was a bit hazy.   Beginning with finding directions to the event.   People who don’t live at Microsoft and work on the BizSpark team might not get by with a buried reference to building 33 (and building 25.)  It actually took some detective work to find out that it was hosted at Microsoft.

The event website was poorly designed and didn’t have the pertinent information (or it was hard to find.   Nobody knew how long their pitches should be, how to organize onto teams (online voting didn’t work), or how the weekend would unfold.  Instead of an orientation, they had a few Microsoft speakers giving boring company meeting-style presentations directed at Microsoft employees.

Technical Difficulties. Anytime you put 100+ people in a room, the wi-fi is going to suck.  But it sucked a lot.  And the hosts didn’t notice it because they had private Microsoft intranet connections.  Bizspark was giving out licenses, but that didn’t work smoothely, and if it had, you would have been presented with a download that takes overnight under optimal conditions.  That’s not a big deal, just a perq that could have gone better.  Also, there was another missed marketing opportunity, not for Microsoft, but for the parter who offered hosting, WowRack.  I feel sorry for Ian, who was volunteering to help them.  They couldn’t get VMs set up in the 48 hour time frame.  (To be fair, 1and1.com, our registrar didn’t come through for at least 36 hours too.)

Other than that, the pizza was good, the sandwiches better.  The drinks free (and cold, except on Friday night), and the $50 price tag was a bargain.  A little more organization could have gone a long way to make it even better.

Next post, I’ll talk about the project I worked on at Startupweekend: Backseat Casting.

Startup Weekend Pitch – goal widgets

Here’s my pitch for startupweekend. It’s tonight at the Microsoft campus in Redmond, building 33.  Not overly ambitious, but not too difficult either.

People are more open with strangers about themselves.

I don’t know why…

Some people feel a need to express to the world:

  • what they had for dinner last night
  • their relationship status
  • how much they adore their favorite celebrity
  • how they really feel about vi, or Emacs, or national health care

Even if no one else is listening.  There is that tantalizing glimmer of hope that maybe someone is listening, that maybe someone agrees with us, is like us, will like us.

* * *

I blog about software testing.

I voice my opinions, with the full knowledge that potential employers, clients, and associates may see my blog and either disagree with me and be offended, or that I might sound like an idiot and be discredited.

I admit that that’s a real possibility – not only am I not a great writer, but I also don’t know that much, and tend to talk about what I don’t know well.

* * *

Social Networking is all rage.  MySpace superceded by Facebook, by Twitter.  Before that, Friendster, LiveJournal, even GeoCities and AOL.

Someone once said “They’re not selling community, they’re selling identity. MySpace is full of lonely, lonely people with 537 friends.”

Someone else said “The web itself is the biggest social network.”

But what is it about walled gardens?

Can’t you get everything on Facebook — a home page, email, a blog, and a photo gallery?  What brings people to these sites?  There must be something.

* * *

I’m not going to talk about that tonight.  (sighs of relief?)  Instead, I am going to pretend what we all know isn’t true.

That there is nothing special about that; that the walled garden social network adds no value and can be duplicated on the open internet.

That “the time has come”.  Just as people gave up AOL for the whole internet, they are ready to give up their social network walled gardens too.

They just need the apps.

We’re one “talk like a pirate” widget or vampire game away from breaking the monopoly (and flying cars and cold fusion.)

Let’s make that widget.

* * *

Here’s my idea:

Mommy blogging is all the rage.  My wife is a mommy blogger.  There are a lot of women out there blogging about their families, showing pictures of their kids to relatives, and linking to all their friends.

And they’re doing it without any hand holding.  Sure, they use Blogger and Picasa (or WordPress and Flickr) instead of editing HTML and coding a script to display their photo albums.  But so do I.

  • How many of you use blogging or gallery software?
  • How many of you have written blogging or gallery software?  (hmm…same people)
  • How many of you are still stuck in the walled garden?
  • What’s keeping you there?  (my friends who only know how to use facebook)

If a bunch of non-geek mommy-bloggers can do it, so can you.  (I’m not disparaging mommy bloggers.)

* * *

(Okay, I said a minute ago I was going to say what my idea is.  Here it is – again:)

There’s this mommy blogger who wanted to lose weight.

She blogged about it.  She posted her picture.  Told the whole world her weight.  And she wrote down every day what her weight was.  What she did about it.

Perhaps a bit unhealthy?  A bit obsessive?  A bit exhibitionist?

Well, it worked.

You’ve all seen (or heard of) the Nike training widget?  Same thing.  For exercise.  Hugely popular.

* * *

I was reading a book the other day called Predictably Irrational.  It talked about a lady who had a problem with debt.  She woke up one day and realized she had some insane amount of credit card debt, negative assets, and quite honestly, things didn’t look good.

So she posted about her debt on her blog.  She tracked her expenditures.  Nothing fancy, no tricks.  Her debt went down.  There are tons of websites where people do this – confess their debt.

Or their pack rat tendencies.  Oprah has a show about one of these subjects every other day  (not that I watch.)

* * *

Why do these things work?  Is it encouragement?  Is it shame?  Is it having to record boring metrics that forces you to be aware?

There’s something about the exhibitionist behavior that helps people get better.  It’s a feature of communities.  It’s part of what makes communities work.

It’s stepping out of anonymity – although being a part of the larger community, being exhibitionist, grants (a different sort of) anonymity.

(But enough gobbledygook.)

* * *

Here’s what I propose (finally – and for real this time):

A widget for blogs (or social networks) that allows you to track your goals.

  • The first part is admitting you have a problem
    (12 step program?)
  • The next part is telling others about it.
  • The third part is tracking your behavior
  • Then you set some goals
  • And watch the progress-o-meter

(Step 3 … profit!)

* * *

There could be multiple widgets, or a single application because there is a common pattern, but I think specially targeted apps would be better.

They could be built around a common core that might be refactored out of it.  But to the user they would be individual apps.

* * *

So I think this weekend, we could pick one vice (or virtue) and make a blog widget for tracking progress on a goal to overcome (or achieve) it.

It could be for:

  • weight loss or exercise
  • debt or savings
  • quitting smoking
  • or anything else you can think of

An interesting idea about savings (also from the Predictably Irrational book) would be a kind of layaway program.  You want to get a new bike or car or iPod.  You cut out lattés and movies and watch the savings grow until the price is met, and boom!

You get your reward.

I don’t know about collecting money and then paying it back, but that could be an option for the future.

* * *

The widget could be written in Flash (or Silverlight), with a web (or RIA) interface for tracking and entering data.

With something like a community, a weekly newsletter, and forums for encouragement, and maybe advertisers – though I am not suggesting advertising as a way of monetizing.

The community could potentially drive visitors – well wishers (or voyeurs) – to your blog, so that has value too.

The goal at first would be to build a reputation, to show there is a market.  Then it could be white-labeled, tied in with a product or promotion (for instance Nike – or “Race for the Cure”.)  There could even be a potential for “March of Dimes” style commitments for people wanting to do fundraisers and take pledges.  But that’s another avenue.

The nice thing is that it is small, simple to implement, and could grow into a platform – but a proof of concept could be built in a weekend.  We could explore different markets (goals), different platforms – maybe I am wrong about walled gardens and it’ll be big on Facebook.

Anyway, that’s my idea.  Thanks for listening.

Exclusivity and Evolution in Social Networks

Researching social networks is fun.

Twitter is probably the first big social media site I’ve been seriously involved in.  I have a fairly limited set of friends (about 30), only a few of which preceded my joining Twitter — and most of those are only tangential.

The nice thing I like about Twitter is that you can explore potential relationships in a way not as easily done with popular –popularity-based– social networks such as MySpace, FaceBook, LinkedIn, etc.  While popularity is definitely a common motivation on Twitter, it doesn’t have as many rewards as other sites, partly because of it’s ephemerality, and partly because your popularity “score” isn’t as easily seen by others who use 3rd party tools such as TweetDeck.  The result being that there isn’t as much pressure to accept friends on Twitter, and not as much stigma to dropping them.  It may be that because the relationships are one sided (followers/folllowing), but it also seems that most people have roughly equivalent lists, so there isn’t the non-recipricosity you’d expect with either spam followers or real popularity except with celebrities.  Things such as celebrity tweets may be the death of Twitter, since users flee from such artificiality.  Perhaps not all users, but the the ones that have strong networks and tend to pull others from one network to another.

Celebrities (and politicians) follow the crowd, they don’t generate it.  Their status as celebrities is bestowed by their popularity.  While celebrity itself can draw a crowd, it is dependent on the crowd’s approval.  In a word, it is “fleeting”.

Crowds have value to advertisers (and politicians) because that’s where you can find constituents/consumers.  But creating value for advertisers drives away those valuable participants who have strong networks, interesting ideas, and create content that draws the crowds.  Not that those participants are especially valuable to advertisers themselves, but for their draw.

Some networks try to combat the encroaching artificiality by being exclusive.  But can an exclusive network be based on merit when exclusion is based on elimination, not inclusion?  Exclusivity is almost by definition not merit-based, and synonymous with snobbery.  Sites like asmallworld.com inevitably end up with no value except to the vaccuous vain and (temporarily) to advertisers.  Because their exclusivity is based on materiality, the participants have large sums of money to spend, and surprisingly similar tastes.  Unfortunately, exclusivity, if it doesn’t tend to drive out the valuable participants, has no way of drawing them in.  But if you’re not trying to draw the crowd, the valuable participants are not as valuable to you, but then you depend on vacuity, which cannot last.  Nature abhors a vacuum. (And so do even the very rich.)

Niche markets are also of value to advertisers, because they can target the advertising.  Big ticket items just happen to be another niche in that respect.  Likewise, by being in a niche, you are also participating in self-selectivity.  A benefit of self-selection is that it is not quite exclusive, but the downside to advertisers is that artificiality is easily spotted in a self-selective group.

Some say niche social sites are the future of social networks, but because of their limited value to advertisers (except those that are geniuinely a part of the niche — such as a model train company to a model train fansite) means they will have limited draw.  You don’t want a fragmented market, you want a segmented market. Perhaps niches within general networks will become successful.

I suspect advertising (and hence funding) will follow the crowd drawn by the valuable participants, who I’ve already argued will retreat from the artificiality of non-niche advertising.  Which, if correct, necessitates a constantly shifting serial social network landscape.  In other words, Facebook will fall within two years.  The same way MySpace and Friendster fell before it.

Will there always be a tendency towards a single “most popular” site?  Or will it balance between triumvirate, like network TV, automaters, and other industries?  First, the other triumvirates are losing their grip.  Second, and more important, because membership and participation are vital to social networks, people can’t split their time effectively.

If exclusivity isn’t the answer, maybe evolution is.  Unfortunately, the cost of evolution in social networks means that the cost of recreation may end up being more than the value created. Eventually, advertisers will see the trend of rise and fall, and not give such big valuations.  So efficiencies will have to be introduced.

Perhaps one network will eventually be able to adapt (as opposed to evolution, which would mean that one with an advantage would supercede the previous), though I suspect the reliance on advertising revenue (eventually) will prevent that.

What efficiencies can be introduced?  Or asked more concretely, what is duplicated?  Features such as login, profile, avatar image are obvious choices, but nothing has been successful yet.  There is a degree of trust that has not been built yet, and perhaps never will.  Higher level functions like messages, status updates, and groups might be possible.  Applications like blogs and photo galleries can be.

The core of social networks, the network of members is the main obstacle to sharing, because the sites themselves consider the network their value.  But that’s not it at all.  It’s the crowd.  The network is what keeps the crowd on their site, what makes it “sticky”.

One possibility is a utility that could provide core services such as profiles and allow networking, but the value (crowd) is provided by niches.  You can see Ning and Microsoft Live positioning for this from different ends.

There are some assumptions I am making that could be incorrect:

  • The “valuable” participants might not be that critical
  • Exclusivity might not be antithetical to merit
  • Advertising might not necessarily be artificial
  • A social network monopoly may be able to adapt and not lose it’s edge because of advertiser control
    I believe Google is actually evidence that it does.  Adwords has jumped the shark, and if they don’t find a replacement, Google will be history.  Between Adwords and Doubleclick, they have the potential to track (and thus monetise) internet-wide usage, but something more than “do no evil” has prevented them from succeeding.
  • People may eventually trust another monopoly they haven’t been willing to with Microsoft.
  • The very rich (& other niches) might not need to follow the crowd makers
  • Valuable participates such as content creators and network leaders might be able to be paid to stick around.  That’s the model that traditional media has followed in the past, but it hasn’t been able to compete against the new media effectively so far.

WordPress on the fritz

First, my gravatar image disappeared. Then my whole theme. Is wordpress.com experiencing technical difficulties?

I then tried to upload a profile picture, but it added my photo as a favicon. What’s going on?

Python testing tools

Python is getting to be quite popular as the language of choice for testers.    One nice thing about Python is the philosophy that there should be “only one way to do it” — the exact opposite of Perl’s mantra “there’s more than one way to do it.”

This lends precision to Python scripts which might not be the case with other tools.  Of course, above the bare language level, there are idioms to learn and a variety of tools that can be used.

Here are a number of tools written in or using python for testing:

unittest – this is a typical xUnit framework, and will probably be the base of most tests.  There are the expected methods setUp() and tearDown(), as well as asserts.  Tests extend TestCase,  are grouped into TestSuites, and executed with TestRunners the default being TextTestRunner.    Nothing surprising here for xUnit users, and a clear, concise way to get started for those new to writing code tests.  A couple niceties for running unit tests in Python that show maturity (over JUnit, for example) are the TestLoader and TestResult classes, for organizing tests into suites and gathering results, respectively.

Selenium – Selenium RC is written in Java, but has a python driver. A good way to ease into Python test development is through the Selenium IDE which can convert recorded tests into Python.  Not only will it help you learn the Selenium API and Python syntax, but it will also introduce you to unittest.

Windmill – Windmill is very similar to Selenium, but written in Python.  It uses a web proxy, is javascript driven, and includes a test recorder that works with Internet Explorer.  This seems to be a popular feature and is helping Windmill gain converts.  For me, however, the interactive shell is much more interesting and more useful than the Selenium interactive experience.  If you prefer, you can write your tests in Javascript as well as Python.

twill – twill is “a simple scripting language for Web browsing”.  Think of it as a selenese-style interface for the grandmother of all web testing techniques, the venerable (and painful) telnet port 80.  Another analogy would be using htmlunit from a command line.  It looks very interesting for non-browser-based testing.

Pamie – Pamie is a port of Samie, a Perl framework for automating IE via COM.  Watir (Watij, Watin) is a similar framework written in Ruby which is probably more mature.  I don’t know if Pamie is still active.

Mechanize – There is also a port of Perl’s WWW::Mechanize to Python for those who like it.

WebUnit – WebUnit is an extension of unittest that provides additional features for web testing.  A WebTestCase drives an HTTP Request and has additional helpers.   It looks fairly simple and straightforward, and would fall into the same category of non-browser driven tests with Mechanize, Twill, HTMLUnit, and Webrat, though probably not as featureful.  (But sometimes you don’t need all the features.)

Fitnesse – Fitnesse, like Selenium is written in Java, but fixtures can also be written in Python via Jython.  There is also a port of Fit called PyFit, but it may be outdated.  Personally, I like the idea of wiki documentation tied to user-editable test data and developer written test fixtures as code.  I’d like to see updated Fit style testing frameworks with a better wiki than Fitnesse.

webtest – Not to be confused with Canoo Web Test, webtest “is an extraction of paste.fixture.TestApp" In a nutshell, it’s for testing at the WSGI application layer.

Saving the best for last…

doctest – Write literate tests using docstrings.  Ability to execute tests from the Python shell.  It’s like fitnesse in your source code.

nose –   “nose extends unittest to make testing easier.”  It’s the way the cool kids are writing their tests in Python these days.  I don’t know much about it.

py.test – py.test is an alternate testing framework, that is also compatible with unittest (and nose).  It’s quite different, emphasising simplicity (in code) with “no boilerplate test functions”.  I haven’t quite wrapped my head around it, but the website says it is a “mature command line testing tool” that “automatically collects and executes tests” and “supports many testing practises and methods”.  Perhaps it’s Python’s answer to Rspec, but going in a completely different direction.  One that looks much more interesting to me.

See also the following:

http://pycheesecake.org/wiki/AgileTestingArticlesAndTutorials

http://pycheesecake.org/wiki/PythonTestingToolsTaxonomy

http://www.simplistix.co.uk/presentations/testing04/testing04.pdf

http://www.opensourcetesting.org/unit_python.php

http://us.pycon.org/2009/conference/schedule/event/88/

Differences between print & echo in PHP

First, let me state that print has not been deprecated in favor of echo.  At least I couldn’t find any evidence of it.  (You know who you are.)

There are two clear differences between  print and echo in php.

  • print always returns 1, echo does not return anything
    This means that print can be used in expressions, where echo cannot:

    
    if (print "hi" == 1) { print "print returned 1"; }
    
    
  • echo concatenates arguments, print does not
    This means you can use commas instead of periods for concatenation:

    
    $enthusiasm = array('.', '!', '!!', '!!!');
    echo "Hello", "," . " ", "world", $enthusiasm[1];
    
    

Note that this means print can produce undesired results in expressions if you expect the parentheses to take precedence, as they do with a function call.  See this comment on the php.net reference documentation.

See also this post about the differences between print and echo:

http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40

Also see this comment about performance differences:

http://www.php.net/manual/en/function.print.php#66392

Short answer, the performance difference is negligible.

An interesting experiment might be to compare argument based concatenation in echo with the concatentation operator in print:

<? #hidad.php
ob_start();
for($i=0; $i<$argv[1]; $i++) { echo 'Hi ', 'dad'; }
ob_end_clean();
?>

<? #himom.php
ob_start();
for($i=0; $i<$argv[1]; $i++) { print 'Hi '. 'mom'; }
ob_end_clean();
?>

Results


c:\temp> time php himom.php 1000000
real    0m1.344s
user    0m0.046s
sys     0m0.000s

c:\temp> time php himom.php 1000000
real    0m1.306s
user    0m0.015s
sys     0m0.031s

c:\temp> time php himom.php 1000000
real    0m1.318s
user    0m0.000s
sys     0m0.046s

c:\temp> time php hidad.php 1000000
real    0m1.215s
user    0m0.015s
sys     0m0.031s

c:\temp> time php hidad.php 1000000
real    0m1.180s
user    0m0.000s
sys     0m0.031s

c:\temp> time php hidad.php 1000000
real    0m1.242s
user    0m0.015s
sys     0m0.015s

It looks like there is a slight edge to echo argument concatenation, at least with my limited sample on Windows Vista (using time via Cygwin for benchmarking.)  echo also beat out print with a concatenation operator by a smaller margin, but the differences are too slight to be definitive.

I used output buffering to remove IO from the equation.  I used ob_end_clean() instead of ob_flush() to avoid printing out the results, though we might still be primarily measuring the  efficiency of deleting the buffer.

I tried a smaller result set (10000 vs. 1000000) and got comparable measurements, of about 1/3 the duration, which I’d guess means that most of that time is spent initializing the php interpreter.


c:\temp> time php hidad.php 10000
real    0m0.337s
user    0m0.015s
sys     0m0.047s

c:\temp> time php himom.php 10000
real    0m0.342s
user    0m0.000s
sys     0m0.062s

c:\temp> time php himom.php
real    0m0.315s
user    0m0.031s
sys     0m0.015s

c:\temp> time php hidad.php
real    0m0.330s
user    0m0.000s
sys     0m0.046s

Also note that I modified my script to use a static iteration number (1000000) instead of a variable ($argv[1]) .and got significantly greater speed improvement than the difference between using print and echo or the difference between dot concatenation and comma (argument) concatenation.

<? #himom.php
ob_start();
for($i=0; $i<1000000; $i++) { print 'Hi '. 'mom'; }
ob_end_clean();
?>

c:\temp>time php himom.php
real    0m1.055s
user    0m0.000s
sys     0m0.062s

c:\temp>time php hidad.php
real    0m0.969s
user    0m0.015s
sys     0m0.015s

Finally, even the difference between printing the text “Hi mom” and “Hi dad” appears slightly different, but now we’re just getting lost in noise.