-
Notifications
You must be signed in to change notification settings - Fork 93
TextGrid.seedFillOld takes considerable amount of time #66
Copy link
Copy link
Open
Description
The following diagram takes more than 30 seconds to produce an image:
+-------------------+
| ABCD_RSTAR_MAIL |
| [ABCD_RSTAR_MAIL] |
+-------------------+
|
PROCESS_ALL_APPLICATIONS (//) -> subStep.each(createPod) V
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| || |
| || <application, packname, installeurDir> |
| PROCESS_APPLICATION (+) -> each(applicationsList) \/ |
| +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |
| | | | |
| | | | |
| | PROCESS_PREPARE_INSTALL (//) V | |
| | +----------------------------------------------------------------------------------------------------------------------------------------------------------+ | |
| | | || || | | |
| | | || || | | |
| | | \/ PROCESS_PREPARE_INSTALLEUR (+) \/ | | |
| | | +-----------------------------------------------+ +----------------------------------------------------------+ | | |
| | | | GENERATE_PACK | | | | | | |
| | | | [INSTALL_APPS, INSTALL_BATCHS, GENERATE_PACK] | | | | | | |
| | | +-----------------------------------------------+ | V | | | |
| | | || | +------------------------------------------------------+ | | | |
| | | || | | GET_INSTALLEUR | | | | |
| | | || | | [ INSTALL_EXSTR, CALL_TILOGFHSQZ_ENV, INSTALL_OTLLS] | | | | |
| | | || | +------------------------------------------------------+ | | | |
| | | || | | | | | |
| | | || | | | | | |
| | | || | V | | | |
| | | || | +----------------------------------------------------+ | | | |
| | | || | | GET_CONFIG | | | | |
| | | || | | [ CALL_DGHUYLOMPR_STATUS_DEACTIVATE ] | | | | |
| | | || | | [ INSTALL_APPS, INSTALL_BATCHS, INSTALL_EXSTR ] | | | | |
| | | || | | [ COPY_RESOURCES_WEB, CALL_TILOGFHSQZ_ENV ] | | | | |
| | | || | | [ CALL_DGHUYLOMPR_STATUS_ACTIVATE, INSTALL_OTLLS ] | | | | |
| | | || | +----------------------------------------------------+ | | | |
| | | || | | | | | |
| | | || | | | | | |
| | | || | V | | | |
| | | || +----------------------------------------------------------+ | | |
| | | || || | | |
| | | || || | | |
| | | \/ \/ | | |
| | +----------------------------------------------------------------------------------------------------------------------------------------------------------+ | |
| | | | |
| | | | |
| | PROCESS_INIT_INSTALL (//) V | |
| | +-------------------------------------------------------------------------------------------------------------------------------------------+ | |
| | | || || || | | |
| | | || || || | | |
| | | \/ \/ \/ | | |
| | | +--------------------------------+ +-------------------------------------+ +------------------------------------------------------+ | | |
| | | | GET_PACK | | DEACTIVATE_ENV_DGHUYLOMPR | | EXEC_INSTALLEUR | | | |
| | | | [INSTALL_APPS, INSTALL_BATCHS] | | [CALL_DGHUYLOMPR_STATUS_DEACTIVATE] | | [ INSTALL_EXSTR, CALL_TILOGFHSQZ_ENV, INSTALL_OTLLS] | | | |
| | | +--------------------------------+ +-------------------------------------+ +------------------------------------------------------+ | | |
| | | || || || | | |
| | | || || || | | |
| | | \/ \/ \/ | | |
| | +-------------------------------------------------------------------------------------------------------------------------------------------+ | |
| | | | |
| | | | |
| | PROCESS_INSTALL (//) V | |
| | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |
| | | || <nodeType=batchs> || || || || | | |
| | | || || || || || | | |
| | | PROCESS_INSTALL_BATCHS (//) \/ [ INSTALL_BATCHS ] || PROCESS_INSTALL_APPS (//) \/ [ INSTALL_APPS ] || PROCESS_INSTALL_EXSTR (+) \/ [ INSTALL_EXSTR ] | | |
| | | +----------------------------------------------------+ || +-----------------------------------------------+ || +-------------------------------------------------------------+ | | |
| | | | || | || | || | || | | | | | |
| | | | PROCESS_INSTALL_BATCHS_NODE (+) \/ | || | PROCESS_INSTALL_APPS_NODE (+) \/ | || | | | | | |
| | | | +------------------------------------------------+ | || | +-------------------------------------------+ | || | V | | | |
| | | | | | | | || | | | | | || | +----------------+ | | | |
| | | | | | | | || | | | | | || | | INSTALL_EXSTR | | | | |
| | | | | V | | || | | V | | || | +----------------+ | | | |
| | | | | +-------------+ | | || | | +-----------+ | | || | | | | | |
| | | | | | STOP_BATCHS | | | || | | | STOP_APPS | | | || | | | | | |
| | | | | +-------------+ | | || | | +-----------+ | | || | V | | | |
| | | | | | | | || | | | | | || +-------------------------------------------------------------+ | | |
| | | | | | | | || | | | | | || | | |
| | | | | V | | || | | V | | || | | |
| | | | | +------------------+ | | || | | +----------------+ | | || | | |
| | | | | | UNINSTALL_BATCHS | | | || | | | UNINSTALL_APPS | | | || | | |
| | | | | +------------------+ | | || | | +----------------+ | | || | | |
| | | | | | | | || | | | | | || | | |
| | | | | | | | || | | | | | || | | |
| | | | | V | | || | | V | | || | | |
| | | | | +----------------+ | | || | | +--------------+ | | ||___________________________________________ | | |
| | | | | | INSTALL_BATCHS | | | || | | | INSTALL_APPS | | | ||------------------------------------------ | | | |
| | | | | +----------------+ | | || | | +--------------+ | | || || | | |
| | | | | | | | || | | | | | || || | | |
| | | | | | | | || | | | | | || PROCESS_INSTALL_RESOURCES_WEB_HELP (+) \/[ COPY_RESOURCES_WEB ] | | |
| | | | | V | | || | | V | | || +-------------------------------------------------------------+ | | |
| | | | | +----------------+ | | || | | +------------+ | | || | | | | | |
| | | | | | STATUS_BATCHS | | | || | | | RSTAR_APPS | | | || | | | | | |
| | | | | +----------------+ | | || | | +------------+ | | || | V | | | |
| | | | | | | | || | | | | | || | +-------------------------+ | | | |
| | | | | | | | || | | | | | || | | GET_RESOURCES_WEB_HELP | | | | |
| | | | | | | | || | | V | | || | +-------------------------+ | | | |
| | | | | | | | || | | +-------------+ | | || | | | | | |
| | | | | | | | || | | | STATUS_APPS | | | || | | | | | |
| | | | | | | | || | | +-------------+ | | || | V | | | |
| | | | | | | | || | | | | | || | +-------------------------+ | | | |
| | | | | | | | || | | | | | || | | COPY_RESOURCES_WEB_HELP | | | | |
| | | | +------------------------------------------------+ | || | +-------------------------------------------+ | || | +-------------------------+ | | | |
| | | | | | || | | | || | | | | | |
| | | | V | || | V | || | V | | | |
| | | +---------------------------+------------------------+ || +-----------------------------------------------+ || +-------------------------------------------------------------+ | | |
| | | || || | | |
| | | || || | | |
| | | || || | | |
| | | || || | | |
| | | || || | | |
| | | || || | | |
| | | PROCESS_INSTALL_${tool} (+) \/ [ INSTALL_OTLLS ] PROCESS_INSTALL_RESOURCES_WEB (+) \/ [ COPY_RESOURCES_WEB ] | | |
| | | +-------------------------------------------------+ +-------------------------------------------------------------+ | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | V | | V | | | |
| | | | +-------------------------+ | | +--------------------+ | | | |
| | | | | GET_TOOL_CONFIG_${tool} | | | | GET_RESOURCES_WEB | | | | |
| | | | +-------------------------+ | | +--------------------+ | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | V | | V | | | |
| | | | +-----------------+ | | +--------------------+ | | | |
| | | | | INSTALL_${tool} | | | | COPY_RESOURCES_WEB | | | | |
| | | | +-----------------+ | | +--------------------+ | | | |
| | | | | | | | | | | |
| | | | V | | V | | | |
| | | +-------------------------------------------------+ +-------------------------------------------------------------+ | | |
| | | || || | | |
| | | || || | | |
| | | \/ \/ | | |
| | +-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------+ | |
| | | | |
| | | | |
| | V | |
| | +------------------------+ | |
| | | DELIVER_ENV_DGHUYLOMPR | | |
| | | [CALL_TILOGFHSQZ_ENV] | | |
| | +------------------------+ | |
| | | | |
| | | | |
| | V | |
| | +------------------+------------------+ | |
| | | ACTIVATE_ENV_DGHUYLOMPR | | |
| | | [CALL_DGHUYLOMPR_STATUS_ACTIVATE] | | |
| | +-------------------------------------+ | |
| | | | |
| | | | |
| | V | |
| +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |
| || |
| || |
| \/ |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
V
+--------------------------------+
| TAG_REF_CONFIG |
| [INSTALL_APPS, INSTALL_BATCHS] |
+--------------------------------+
|
|
V
+-----------------+
| ABCD_END_MAIL |
| [ABCD_END_MAIL] |
+-----------------+
Here's the flamegraph:
As you can see 80% of the time is spent in the TextGrid.seedFillOld method:
ditaa/src/java/org/stathissideris/ascii2image/text/TextGrid.java
Lines 1354 to 1383 in f2286c4
| private CellSet seedFillOld(Cell seed, char newChar){ | |
| CellSet cellsFilled = new CellSet(); | |
| char oldChar = get(seed); | |
| if(oldChar == newChar) return cellsFilled; | |
| if(isOutOfBounds(seed)) return cellsFilled; | |
| Stack<Cell> stack = new Stack<Cell>(); | |
| stack.push(seed); | |
| while(!stack.isEmpty()){ | |
| Cell cell = (Cell) stack.pop(); | |
| set(cell, newChar); | |
| cellsFilled.add(cell); | |
| Cell nCell = cell.getNorth(); | |
| Cell sCell = cell.getSouth(); | |
| Cell eCell = cell.getEast(); | |
| Cell wCell = cell.getWest(); | |
| if(get(nCell) == oldChar) stack.push(nCell); | |
| if(get(sCell) == oldChar) stack.push(sCell); | |
| if(get(eCell) == oldChar) stack.push(eCell); | |
| if(get(wCell) == oldChar) stack.push(wCell); | |
| } | |
| return cellsFilled; | |
| } |
I'm not familiar with the code base but maybe it can be optimized?
Let me know if you need more information, I will gladly provide them 🤗
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
