Some time ago, I wrote a Python script to extract data from HTML file and write it as JSON. These days I'm learning Rebol, so I tried to rewrite it, and consider the differences. Here are the results of comparing the two versions:
Code LengthPython: 5261 chars / Rebol: 5005 chars. But 930 chars were literal strings. So if you want to consider "code length" in a fairer sense, it becomes: Python: 4371 chars / Rebol: 4075 chars.We must alo consider that Python code gets benefits from the HTMLParser module and the built-in decoding facilities. They weren't in Rebol, so I had to add two new functions to get what I needed. A little more work to do, but when you consider that counted in the size... Rebol seems more concise than Python.
SpeedI tested performance by processing 52 of the HTML files to get the JSON on my Android phone:
- Test 1 -- Processing the files all at once: Python: 12.2 +- 0.2 s / Rebol: 11.7 +- 0.1 s
- Test 2 -- Processing the files one by one: Python: 44.9 s / Rebol: 15.4 sThe startup times are: Python: 0.641 +-0.004 / Rebol: 0.073 +- 0.002 sThe pure-running times are: Python: 11.56 +- 0.2 s / Rebol: 11.63 +- 0.1 s
SummarySpeed seems equivalent once the code starts running. But Rebol starts up much faster! Makes it very good in shell scripts.