Archive for October, 2013

Perl class builders

Saturday, October 26th, 2013

The beauty of Perl is choiceSome would argue there’s too much of it. When it comes to advanced OO features, Perl has many options to choose from. None of them are actually in the core but are available as third-party modules from CPAN. This will hopefully get fixed in the future.

One such an OO framework that is really popular among Perl developers is Moose. The problem with Moose is that it does everything and it also depends on many outside modules. But Moose led to some interesting experiments, one of which is Mo. Along with Mo, I have evaluated another minimal OO class builder for Perl, named Class::Tiny, which is in fact an Object::Tiny workalike. Confused already?

I like both class builders because they are minimal require no outside modules, so I had to test which one of them offered more useful features while still being fast. The code that I used to do this is available here. For the second test everything in the main package was wrapped inside a loop that ran 1e6 times. Current versions (Mo 0.37 and Class::Tiny 0.011) were tested on an Athlon 64 x2 box running at 1 Ghz with two gigs of RAM. Here are the results:

Mo Class::Tiny
1 run 1e6 runs 1 run 1e6 runs
real 0m0.016s
user 0m0.012s
sys 0m0.004s
real 0m20.719s
user 0m9.013s
sys 0m4.492s
real 0m0.033s
user 0m0.028s
sys 0m0.000s
real 0m28.745s
user 0m17.093s
sys 0m4.816s

As you can see, Mo turned out to be 51% faster in single runs and 28% faster when it ran multiple times. It also has some additional features, without enfocing them on the user – they have to be explicitly enabled. Mo also provides an easier and more obvious upgrade path to Moo, Mouse or Moose. It does not, however, provide multiple inheritance or a destroy method. If you need them, use Class::Tiny or Moo. Also, please keep in mind that benchmarking Mo against Class::Tiny is rather pointless because their feature set is different.

I repeated the test using Benchmark, this time appending to my favourite file descriptor. Mo came out faster by almost 50%. When writing to standard output the results are roughly the same as above. I also tested Mojo::Base, Object::Simple and Object::Tiny. They are roughly on par with one another and a tad faster than Mo, but the difference is only about 16%. Object::Tiny came out the fastest of the bunch.

SRI ne dă indicii?

Tuesday, October 15th, 2013

De data asta un articol oarecum interesant de pe o platformă de stânga, referitor la raspunsul dat de SRI unei solicitări trimise de ActiveWatch:

ActiveWatch solicită directorului Serviciului Român de Informații, George Cristian Maior, și Comisiei comune permanente a Camerei Deputaților și Senatului pentru exercitarea controlului parlamentar asupra activității SRI să prezinte detalii cu privire la amenințarea „extremistă” și „eco-anarhistă” despre care a susținut că planează asupra protestelor privind situația de la Roșia Montană.

Să înțelegem că în situația în care nu există presupușii eco-anarhiști, aceștia vor fi infiltrați chiar de către serviciile în cauză? Scopul evident ar fi deturnarea și discreditarea protestelor pașnice împotriva proiectului minier de la Roșia Montană.

Rezerviștii lui Dogaru, care amenințau anul trecut cu desființarea CCR, nu au periclitat niciodată siguranța națională, dar un protest pașnic împotriva exproprierii abuzive și a jafului instituționalizat o periclitează. Interesant.

Update: Ministrul culturii, Daniel Barbu, are impresii după ce a fost, chipurile, bruscat și compară manifestanții anti-RMCG cu o formațiune paramilitară.

Alte proteste

Thursday, October 10th, 2013

Așa arată un protest adevarat. Totuși, dacă privim dincolo de aparențe, vedem două grupuri de bugetari care se confruntă între ele pe banii contribuabililor. A mai fost și în Franța un protest asemănător acum câțiva ani, când fermierii au dat cu bălegar pe Champs Elysées. Am înțeles perfect partea cu scăderea taxelor, dar mi se pare aiurea să protestezi că scad prețurile din cauza liberalizării comerțului și să ceri subvenții și protecționism.

Government’s view of the economy could be summed up in a few short phrases: If it moves, tax it. If it keeps moving, regulate it. And if it stops moving, subsidize it.

– Ronald Reagan

Update: Și acum, un protest tipic american, cu camioane și motociclete: Ride for the Constitution, truckers rally to shut down DC.

Some articles

Sunday, October 6th, 2013

I’ve recently read two interesting articles about the world we live in. The first one, called The Virus of Imperialism, exposes the US ways of delibertely seeking and provoking wars. It comes in two parts. The other article, entitled Forms of Delirium pictures modern day Russia and its brand new propaganda involving Kremlin sponsored biker gangs, orthodox banner-bearers that burn Harry Potter books, anti-pedophile neo-nazis and puppet politicians.