Scientific method copes with complexity using abstractions. You define symbols, and manipulate them instead of raw, immediate reality. When complexity rises again, you define symbols with symbols and build abstractions of abstractions.
This approach has two problems. First, it requires you to have quite a mind capacity either to be able to manipulate lot of symbols on a low abstraction level, or it requires you to have a highly structured thinking to be able to work on a very high abstraction level.
Second, there symbols we define are quite arbitrary, and there's no proof that the are especially well suited to our situation. On a highly abstract level we can lose our connection with reality, because we might be confusing a map with a territory.
In those cirrumstances, taking a totally intuitive approach doesn't seem THAT insane. Some circuits in our brains are quite well suited for using a hollistic approach to reality. We don't need to manipulate symbols, it's sufficient to be able to percieve our environment, opportunities and possibilities of action and then choose actions though considerations of common sense, aesthetics and a "gut feeling".
I think, that acting in this intuitive mode is an area that requires a lot of training, but i'm not quite sure what KIND of training is well suited for developing one's intuitive side. It all seems too much like a trickery compared to well estabilished scientific methods.
The best way, reserved for real gurus, would of course be a fine-tuned combination of both approaches. Maybe it could even become mainstream, as the science world gives up it's bitterness against the alternative approaches to decision making.
Ruby vs. Python - a lame benchmark.
I needed to write some code to merge two english-czech dictionaries. I'm a Rails-guy and Ruby is my language of choice for the time being. That said I now happen to write some of my projects in Python, because I was lured by the Google's App Engine (along with one of my customers). I expected that Python would be faster, so I've decided to write the code in Python for this reason. I also wanted to give an another try to Python scripting and learn some more Python on the way.
I've written that script, and then I've became very curious. What is the actual speed-up? I had no other option, I had to rewrite it in Ruby as well. Because of my laziness I wanted to use the python2ruby converter at first, but it didn't work for me. It took me some time to do the rewrite because of some of the small syntactical differences.
I have to admit, that in Python I like the semantic indentation and list comprehension. Everything else looks better in Ruby for me. I especially hate Python's inconsistent method calling. You write
string.split(',')
that is quite normal. But when you want to join, you have to do it like this:
','.join(array)
and for checking size, it's yet another way:
len(array)
Also there was no way to check if array contains an item without using exceptions. I also had to use some ugly hacks to force Python to work correctly with UTF-8 strings. Please correct me if you know better, I'm still a Python noob. Anyway, I've finished the code and I ran it on a Core2Duo MacBook 1.6GHz. I used Python 2.5.2, Ruby 1.8.7 and Ruby 1.9.0. I measured the time it took using the classic time command. The results were following:Language | User time (s) | System time (s) | CPU Load (%) | Total time (s) |
---|---|---|---|---|
Python | 7.05 | 0.37 | 80 | 9.204 |
Ruby 1.9 | 10.65 | 0.35 | 77 | 14.264 |
Ruby 1.8.7 | 21.18 | 4.93 | 97 | 26.776 |
We can see that Python is still faster than Ruby 1.9 in this benchmark, but not too significantly. Even Ruby 1.8 performs well enough for me to write those scripts in Ruby next time. I'm leaving the interpretation of system time and CPU Load to the more experienced, but i find it somewhat interesting. I could end with this, but I also wanted to give shot to Google's Chart API, so behold:
Ok, we had enough nice graphs, so I'm saying goodbye to the lowhearted, and I'm going to expose the brave ones to the following ugly code:
Python version:
Ruby version:
For the non-enthusiast's among us: Can you spot 10 differences? Well.. that's all for today and I hope that you had some fun reading this post, because while creating it i had plenty...
Subscribe to:
Comments (Atom)