6

I'm trying to get a little program to send hex over RS232. From what I've seen Python is a very good language to do this with.

I learned it 3 years ago in an into to compsci course as a freshman in high school, and the syntax is amazing. It's pretty much like pseudo code.

However ever since freshman year I have been working with Java, Objective-C (god bless my poor soul), and C#.

Anyway, I would like to use Python for learning how to use serial communication. Now that I am looking at it again I have "discovered" Jython which appears to be python but it uses the Java run time (is that correct?)

Will I be happier using something such a Jython rather than good-old Python? Or for such a "little" task as sending hex over serial ports will I not notice a difference?

If you are going to downvote my question can you please at least tell me why? -- thank you.

Sponge Bob
  • 1,551
  • 5
  • 17
  • 23
  • 3
    You should definitely use regular python with pyserial. – TJD Jun 28 '12 at 18:54
  • Ok. I will give that a try. Why though? – Sponge Bob Jun 28 '12 at 19:00
  • Are you saying Java is better than Pyhton? – lvella Jun 28 '12 at 19:29
  • No, they are completely different languages. They each have their goods and their bads. If I thought Java was "better" than python I would be trying to do this in Java. That being said, I do think that java is a much more efficient language and can execute commands much quicker, and utilize memory much more efficiently; for a novice programmer like myself. – Sponge Bob Jun 28 '12 at 19:36
  • 5
    @KeeganMcCarthy, by default you should favor the common, well-worn solution unless you have sufficient motivation to deviate into something uncommon. Doesn't sound like you have any reason to consider Jython. Using Jython will take you extra time/effort, increase likelihood of issues, decrease your portability, and in the end, not be any faster. Also, if you're talking about using RS232, then speed of the rest of your system is of no concern because RS232 will be your bottleneck by far. – TJD Jun 28 '12 at 19:36

2 Answers2

5

For one of my projects, I decided to benchmark Jython, CPython and Pypy using the project's innermost loop. Jython was a little slower than CPython with Cython, but faster than unaugmented CPython. In general, Jython is respectably fast for long processes, but it takes a while to get started.

If you want to use Jython, go ahead and use Jython. Python != CPython anymore.

Here's the comparison _for_one_microbenchmark_: http://stromberg.dnsalias.org/~strombrg/backshift/documentation/performance/index.html

user1277476
  • 2,871
  • 12
  • 10
4

Like you said, Jython is Python implemented on top of JVM, see Jython As far as I can tell, it's usually slower than CPython(which is what you call the good-old python).

The real advantage of Jython is that it can import and use any Java class (and the same applies for .NET and IronPython).

Diaa Sami
  • 3,249
  • 24
  • 31