Issue2886

classification
Title: doing relative imports in a loop causes bad performance due to 2472
Type: behaviour Severity: major
Components: Core Versions: Jython 2.7.2
Milestone:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: hansiang93
Priority: Keywords:

Created on 2020-05-08.23:03:32 by hansiang93, last changed 2020-05-08.23:05:23 by hansiang93.

Messages
msg13048 (view) Author: han (hansiang93) Date: 2020-05-08.23:04:14
the issue https://bugs.jython.org/issue2472 and its subsequent resolution bc317e2 causes a side effect where jython will attempt to find a relative import again and again despite having done so in the past.

This violates expected python 2.7 relative import optimisation that places a None whenever an import is not found as opposed to null.

Consider the case of a local import being done on a loop without the use of absolute imports, we will attempt to generate all java classes, org.python.core.JavaImportHelper.tryAddPackage(), org.python.core.JavaImportHelper.buildLoadedPackages(), and java.lang.Package.getPackages() which add up to tons of CPU time usage.
History
Date User Action Args
2020-05-08 23:05:23hansiang93settype: crash -> behaviour
components: + Core
2020-05-08 23:04:14hansiang93setmessages: + msg13048
title: -Qnew results in jython failing -> doing relative imports in a loop causes bad performance due to 2472
2020-05-08 23:03:32hansiang93create