[Discuss] 'C' string tokenizer for those who hate strtok

Brian Quinlan brian at sweetapp.com
Fri Jun 30 12:14:13 PDT 2006


David Bronaugh wrote:
> Brian Quinlan wrote:
>> And my opinion is -- just use Python (or Ruby [or Perl]).
> Have fun writing graphics code in Python.

Actually, there are a lot of projects that do just that. Google (whose 
web crawler is written in Python) for "pygame". There is also a lot of 
scientific plotting software for Python, OpenGL bindings, etc.

I'm not suggesting that you write the inner loop of your 1st person 
shooter in Python but instead the 50-90% of your program which is not 
performance critical.

> Once you stop using built-ins the interpreter overhead comes into play.

I was going to say "of course it does" but then I realized that I don't 
understand the term "interpreter overhead" in this context. Python is a 
language - it doesn't specify the a particular implementation. There is, 
for example, a specializing compiler for Python (called psyco) which 
generates code which is often competitive with C code, from a runtime 
performance perspective. The EU is also funding a project which aims to 
create a Python implementation that can target machine code. But all 
that is an aside.

This real questions is about approach. Which approach makes the most sense:

1. write in the highest level language possible, optimize as necessary
    (possibly rewriting time-critical portions in in C or even assembly
    language)
2. write all software in C (or assembly language [or fab your own
    ASICs]) and live with the lost developer productivity, maintenance
    costs, etc.

Cheers,
Brian


More information about the Discuss mailing list