Pushing takes less than a second or two but shifting off the first 1000 elements takes over 17 seconds on my machine.

Now take that same data and create a basic FIFO class that has push() and shift() methods. Use pack() and unpack() to store the data in a long string. Total time to push 100,000 and shift the first 1000 elements is around 1 second. Total memory is 7 megabytes which is less than 10% of PHP’s internal array()’s consumption.

PHP’s splFixedArray class which is advertised as mainly having a speed advantage doesn’t fair much better. With a fixed array created of 100,000 elements and loading and unloading the same associative array() it grows by 75 megs but is very fast at half a second. Just for fun I pushed 100,000 elements on an splFixedArray which are simply the values of the test associative array concatenated into a string and it’s still weighs in at 13 megabytes.

Spain has been all over the press this weekend with a 100 Billion euro bailout agreed to by Eurozone finance ministers. I spent the last three days in Spain and I find the coverage I’m reading somewhat disconnected with reality.

I drove down to Madrid from where I live in Southern France and spent Thursday, Friday and Saturday morning there, then drove back home and spent Saturday evening in Pamplona where the San Fermin festival starts in a month with the running of the bulls.

Madrid is a shining jewel in Europe. The city is immaculately clean and has a wonderful mix of new buildings like the Cuatro Torres that make for a spectacular modern skyline juxtaposed against gorgeous old buildings like the Royal Palace.

Walking in the Parque del Oeste where the Egyptian temple of Debod was moved to save it from the Aswan Dam, the park is filled with locals who have come out at night for their evening walk. Kids playing, groups of older women or men walking together, lovers in a quiet secluded spot in the park. Everyone is happy and full of life.

Driving around Spain there is an incredible amount of active road construction and the roads that aren’t being worked on are in great condition with many spectacular bridges.

Pamplona was absolutely heaving with party-goers on Saturday night including a huge Spanish rock festival, packed bars and pubs and streets literally filled from wall to wall in the older part of town – and the newer part was full of locals out for their evening walk. I visited a heavy metal bar with an Iron Maiden cover band doing a terrible rendition of Maiden’s older stuff and the standing-room-only crowd loving every second of it.

While in Madrid I got chatting to a local shopkeeper and went out on a limb and asked her about the informal or under-the-table economy in Spain. She explained that many people are employed off the books. I asked why, speculating that the tax in Spain is very high. She explained yes that’s one reason, but taxes are higher in Italy where she’s originally from. Another reason is to keep getting social benefits like a housing benefit. She also said it’s popular to pay someone only 70% of what they’re really paid into their bank account and the rest in cash to avoid tax.

More evidence that there’s a thriving off-the-books economy is that when we stayed in Madrid, we rented self catering accommodation. The proprietor asked that we pay the roughly 200 euros bill in cash.

All the economic indicators used to describe the “Spanish crisis” and provide rationales for bailing out spain or to predict how bad the “coming collapse” will be don’t take the informal economy into account. It also makes it difficult to understand the needs of the Spanish people, what the GDP really is, how dependent they really are on social programs and what Spain’s real ability is to service it’s debt.

To some the informal economy in Spain may seem to be immoral because conventional wisdom holds that one should “pay your taxes” and put your money in a safe place like a bank. But the Spanish people seem to be discovering a way to live without banks and government visibility on how much they earn or what they do with their money. I suspect many of the government assistance programs are over subscribed and do little to serve their intended targets.