Title: Looking again at benchmarks
Type: security Severity: minor
Components: Any Versions: Jython 2.7
Status: open Resolution: later
Dependencies: Superseder:
Assigned To: Nosy List: jeff.allen, sergei175, zyasoft
Priority: high Keywords:

Created on 2019-01-24.00:59:06 by sergei175, last changed 2019-10-06.13:39:44 by jeff.allen.

msg12336 (view) Author: Sergei (sergei175) Date: 2019-01-24.00:59:06

Just to draw your attention: There is a discussion thread about some problems with Jython

i.e. certain calculations cannot be done due to very slow execution.
I do not know, is this a feature or a bug. Why other scripting languages (such as Groovy) are so fast? Can this point to some problems in the Jython core?
msg12338 (view) Author: Jim Baker (zyasoft) Date: 2019-01-24.23:27:46
Yes, it is slow for this scenario, at x10 slower as seen here. Jython and CPython should currently be at about the same speed, since they have very close implementations. I did find it interesting that JRuby had very similar performance, which shows how challenging speeding dynamically typed languages is.

There is however one thing that makes things unnecessarily slow: because Jython 2.7 implements the Python 2.7 language, the code should be written to use xrange, not range, which will allocate a list containing 100 million consecutive integers. That's obviously unnecessary overhead.

It is also possible that we can still improve this speed with InvokeDynamic and related support, but that's a hard engineering challenge, even with the improvements in this support in JDK 12.
msg12340 (view) Author: Sergei (sergei175) Date: 2019-01-25.02:01:17
Hi, Jim

 Thanks! I see that the stackoverlow has been already corrected with range()->xrange() for the Jython example. Now it's  much better (40 sec) than it was with "range()". Still, not clear why Groovy is super-fast.

msg12342 (view) Author: Sergei (sergei175) Date: 2019-02-03.02:22:27
Not a bug, but just a free "visionary" idea where to go with Jython
(after reading again the thread )

If Jython will be as fast as Groovy then Jython may easily dwarf CPython in popularity.  This will be a very strong selling point for Jython, and will attract many developers. But one needs to learn what is under the hood of  Groovy/JRuby. Of course, this is a lot of work, but this can be very promising direction.
msg12694 (view) Author: Jeff Allen (jeff.allen) Date: 2019-10-06.13:39:44
Adjusting the priority here so that, if ever we produce a Jython with decent performance for arithmetic (and who wouldn't want that?), we have this to hand. Taking off the 2.7.1 though.
Date User Action Args
2019-10-06 13:39:44jeff.allensetpriority: high
resolution: later
messages: + msg12694
nosy: + jeff.allen
milestone: Jython 2.7.1 ->
2019-02-03 02:22:27sergei175settype: behaviour -> security
messages: + msg12342
severity: major -> minor
components: + Any, - Core
title: Is Jython core slow for numeric calculations? -> Looking again at benchmarks
2019-01-25 02:01:17sergei175setmessages: + msg12340
2019-01-24 23:27:46zyasoftsetnosy: + zyasoft
messages: + msg12338
2019-01-24 00:59:06sergei175create