I know, we already briefly discussed a similar issue privately, but I
think this is more and better than what I said you, so let's discuss
again in public. Note: I don't want to push you on doing something you
don't like to do, I just want to be sure that we do what is best to
have this project succeed, because I really like it.
At present we have a functional (but incomplete?) C++ implementation.
There are some end-to-end tests, but not unit tests yet. I believe
some refactoring of the code is needed, sooner or later, for a few
reasons. Do you agree? But is it worth it?
So my original question was: why don't we (or even just I)
re-implement the thing in python, instead or in addition to the C++
implementation? Python has several advantages compared to C++,
including faster and easier development cycles, testing and
cross-platformity (is it a word?) Of course it also has its own
disadvantages, most notably speed. And developer time wasted in doing
something of little value (at least when compared to other things that
need to be done)
Now, IMHO PyPy changes everything (or, better, it's pypy-translator
that changes everything, when you use it of any interpreter written in
RPython=RestrictetPython as described in the morepypy blog post). In
fact, on x86 or x86_64 (and soon on ARM) CPUs, it's much faster than
you can believe (see http://speed.pypy.org/ but be sure to not fall
from the chair while you read) because it automagically creates a JIT
compiler for *any* language. Can you believe that a program written in
RPython (such a program is the Python interpreter in the
speed.pypy.org website) runs 3 times faster of the same program
written in C (a different implementation of the same Python
interpreter)?? And all without the usual quirks, platform specific
tricks, and obfuscations often needed for the optimization? I expect
that the same at-least-three-time-faster could happen for the proteus
interpreter.
1) so my long-term proposal is:
a) keep the current C++ implementation, maybe make it C-ish or even
pure ANSI-C and use it on platform where the RPython implementation
does not work (forget about making the C++ code clean and the fully
fledged C++ unit test suite)
b) write a clean, and easy RPython implementation, which could run either
- in Python (slow, but any platform that has Python, e.g. IBM's AIX
running on Power), or
- can be compiled with the pypy-translator in a JIT-ed native code
interpreter, almost certainly faster than a) - but only on x86 or
x86_64, regardless of the operating system (I expect the same thing
would apply to ARM, but we can't say for sure now)
2) my short-term proposal is:
a) keep working on the current C++ implementation, but only (or almost
only) fix the bugs that are show stoppers for the demo/prototype or
important models that we need to go forward on that side.
b) start writing the RPython implementation, not as a "hard effort"
but as "code documentation" of what I've so far understood in the
functionality
So now the 2b) is not wasted time because:
alpha) in the future, as described in 1b) this implementation will be
actually useful, not only a proof-of-concept
beta) while studying the language, I need to put in code what I have
understood, for my own reference and doing so in python as opposed to
C++ will be undoubtedly faster
What do you think?
Note: this is somehow biased by my idea that proteus itself will still
need a fair amount of development. If this is not the case (like it
seems from the latest wiki page about dev plans), then I kind-of
retract what I'm saying here, i.e. we can leave it as is, until we'll
need to do major work for it - and just do the 2a plus the creation of
models and similar stuff. But since I wrote this before reading that
wiki page, I'm sending it anyway, instead of saving the draft for
another day, just to have you mulling over it.
Davide
Bye,
Davide