Bug 449465 - Pascal code import is very slow
Summary: Pascal code import is very slow
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: importer (show other bugs)
Version: Git
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-01 16:51 UTC by Jessica
Modified: 2022-06-13 05:56 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.34.70 (KDE releases 22.07.70)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jessica 2022-02-01 16:51:29 UTC
Pascal code import is very slow. Not sure if this is normal. No crash, no error. (some files take minutes to import)

Use following code: https://emuloader.mameworld.info/files/el888-src.rar

STEPS TO REPRODUCE
1.  Import code
2.  Observe the time needed to import the code

OBSERVED RESULT

Pascal code import is very slow. 

EXPECTED RESULT

Pascal code import was much faster in previous version.


SOFTWARE/OS VERSIONS
Windows:  git 126264fd KDE binary factory

ADDITIONAL INFORMATION
Comment 1 Oliver Kellogg 2022-02-02 20:13:59 UTC
el888-source has 241473 total lines of code with a few hefty files,
   3496 ShellCtrls.pas
   3683 Menus.pas
   4740 uCommon.pas
   5145 StdCtrls.pas
   5262 ExtCtrls.pas
   7318 arcade/uMAMESettings.pas
   9057 CommCtrl.pas
  11003 Controls.pas
  18035 system.pas
  22955 ComCtrls.pas
  31087 Windows.pas
  51592 uMain.pas

On importing all, that works out to around 400 lines per second.
I'd say the speed is in a gray area but could use improving.
Don't forget that prior to the fixes, it was importing only a fraction of the classes/attributes due to bugs - that's why it was faster then.
Comment 2 Jessica 2022-02-04 22:41:00 UTC
Ok. The crash is fixed and it's working now!
Comment 3 Jessica 2022-02-18 18:25:11 UTC
*** Removed by KDE Sysadmin for violation of the KDE Community Code of Conduct ***
Comment 4 Oliver Kellogg 2022-06-13 05:56:34 UTC
Git commit 0d855d0deb419f0a38bc486ce0441da42988904b by Oliver Kellogg.
Committed on 13/06/2022 at 05:56.
Pushed by okellogg into branch 'master'.

Fix "Pascal code import is very slow"

umbrello/umllistviewitem.{h,cpp}
- Remove empty reimplementation of destructor (we want the parent
  destructor to execute).
- Member m_comap is renamed to s_comap, changed to `static`, and is
  changed pointer. It now acts as a global map for all UMLObjects
  pertaining to the list view. The switch to pointer is done for
  reducing risk of static initialization order problems.
- New static function deleteItem removes the given UMLListViewItem from
  s_comap and calls its destructor.
- At function findChildObject add `const` on argument `child`.
- New protected function findUMLObject_r is auxiliary to findUMLObject.
  It is invoked when the given object is not found in s_comap.
- Change implementation of ChildObjectMap from QMap to QHash.
  Reason: QHash is more appropriate for pointer arguments.

umbrello/umllistviewitem.cpp
- In function init() allocate s_comap if null.
- Adjust functions addChildItem, deleteChildItem, deepCopy to the
  changes related to m_comap -> s_comap.

umbrello/umllistview.cpp
- In function slotObjectCreated add calls to parentItem->addChildItem()
  for updating s_comap.
- In function slotObjectRemoved replace destruction of `item` by call to
  deleteItem() in order to update s_comap.
- In function init(),
  - reduce content of `if (m_rv == 0)`;
  - call clean() unconditionally;
  - execute for-loop over N_MODELTYPES unconditionally and in its body
    add call to m_rv->addChildItem(sysFolder, m_lv[i]) for updating
    s_comap;
  - call m_lv[Uml::ModelType::Logical]->addChildItem(datatypeFolder) for
    updating s_comap with m_datatypeFolder.
- In function clean(),
  - clean up documentation;
  - set m_datatypeFolder to 0;
  - in for-loop over N_MODELTYPES remove call to deleteChildrenOf() and
    add setting of m_lv[i] to 0;
  - call deleteChildrenOf(m_rv).
- In function moveObject,
  - remove handling of m_doc->loading() (see function acceptDrag);
  - replace `delete move` by UMLListViewItem::deleteItem(move) for
    updating s_comap;
  - add handling of case UMLListViewItem::lvt_EnumLiteral.
- In function addNewItem case instanceOfClass add call to
  instanceItem->addChildItem() for updating s_comap.
- In function loadChildrenFromXMI loading of structural objects add
  call to parent->addChildItem() to update s_comap.
- In function deleteChildrenOf case (typeIsCanvasWidget(lvt) ||
  typeIsClassifierList(lvt)) case !object, replace `delete temp` by call
  to UMLListViewItem::deleteItem(temp).
FIXED-IN: 2.34.70 (KDE releases 22.07.70)

M  +86   -65   umbrello/umllistview.cpp
M  +58   -18   umbrello/umllistviewitem.cpp
M  +8    -6    umbrello/umllistviewitem.h

https://invent.kde.org/sdk/umbrello/commit/0d855d0deb419f0a38bc486ce0441da42988904b