2020 International Conference on Computational Science and Computational Intelligence (CSCI)

CSCI-ISSE Full/Regular Research Paper 2D Animation of Recursive Backtracking Maze Solution Using JavaFX Versus AWT and

Anil L. Pereira School of Science and Technology Georgia Gwinnett College Lawrenceville, GA, USA [email protected]

Abstract—This paper describes software developed by the AWT and Swing have been used widely in legacy software author, that constructs a two-dimensional graphical maze and uses [8]. Even though, software developers claim that there is a steep animation to visualize the recursive backtracking maze solution. learning curve for JavaFX [9], applications using AWT and The software is implemented using three graphics Swing are being rewritten with JavaFX. This is because of technologies, Java , Java Swing and JavaFX’s look and feel and other features mentioned above. JavaFX. The performance of these technologies is evaluated with Also, the performance is claimed to be better, due to its graphics respect to their graphics rendering frame rate and heap memory rendering pipeline for modern graphics processing units (GPUs) utilization. The scalability of their rendering performance is [10]. This pipeline is comprised of: compared with respect to maze size and resolution of the displayed • A hardware accelerated graphics pipeline called Prism maze. A substantial performance gap between the technologies is reported, and the underlying issues that cause it are discussed, • A windowing toolkit for Prism called Glass such as memory management by the Java virtual machine, and • A Java2D software pipeline for unsupported graphics hardware accelerated graphics rendering. hardware • High-level support for making rich graphics simple Keywords—graphics; animation; JavaFX; Swing; AWT with Effects and 2D and 3D transforms

I. INTRODUCTION The software implemented by the author of this paper is comprised of four Java programs. One program called Abstract Window Toolkit (AWT) is the original platform- MakeMaze.java constructs a 2D graphical maze using animation dependent windowing, graphics, and user interface (UI) widget and a randomized version of the well-known depth first search toolkit for Java, first released by in 1995 [1, algorithm. The program stores the information about the maze’s 2]. Swing is a graphical user interface (GUI) for structure in a text file. The other three programs were Java and is part of Oracle Corporation's Java Foundation Classes implemented for the purpose of reconstructing the graphical (JFC). JFC is an Application Programming Interface (API) for maze after reading the information about its structure from the providing GUI for Java programs. Swing was originally text file, and then solving the maze graphically using animation developed by Communications Corporation and was and the well-known recursive backtracking algorithm. The first included as part of the Java Standard Edition release 1.2 in difference in the three programs is that they use different Java 1998. The Swing API mostly extends AWT, but unlike AWT graphics technologies. One of the programs is called components, Swing components are "lightweight". i.e., they are SolveMazeAWTSwing.java (implemented using AWT and not implemented by platform-specific code, instead, they are Swing) and the other two are called SolveMazeFXFill.java and written entirely in Java and are platform-independent [3, 4]. SolveMazeFXNodes.java (both implemented using JavaFX). JavaFX [5] is a software platform released by Sun SolveMazeAWTSwing.java uses AWT to draw the graphics Microsystems in 2008 for constructing and delivering desktop and Swing to construct the GUI frame on which graphics is applications, as well as rich Internet applications (RIAs) that can drawn. The space for the maze is logically divided into a grid of be used on a wide variety of devices. JavaFX became open- rectangular shaped cells. A cell is called a tile. source in 2011. In 2012, it became part of Oracle Corporation’s SolveMazeFXFill.java uses a graphics context object to directly Java Development Kit (JDK). JavaFX is replacing Swing paint each tile in the maze to the program memory, similar to because of several advantages. It is more lightweight, and has SolveMazeAWTSwing.java, but uses JavaFX libraries and Cascading Style Sheets (CSS) styling, FXML and Scene GPU-based hardware accelerated rendering. Builder. Scene Builder allows UI construction by dragging and SolveMazeFXNodes.java adds each rectangle shaped tile as a dropping controls from a palette. This information is saved as node to a scene graph and passes the graph to the GPU-based FXML, a special XML format. Oracle Corporation no longer hardware accelerated rendering pipeline. includes JavaFX with Java since JDK 11. In 2018, JavaFX was made part of OpenJDK under the OpenJFX project to hasten the The main contribution of this paper is the evaluation of the pace of its development [6, 7]. graphics rendering performance and scalability of Java Swing and AWT when compared to JavaFX, for the purpose of 2D animation. To the best of the author’s knowledge, there is no

978-1-7281-7624-6/20/$31.00 ©2020 IEEE 1787 DOI 10.1109/CSCI51800.2020.00330 work reported in the available peer-reviewed technical literature, The program produces a graphical representation of the maze that researches this specific topic and discusses the effects of through animation, when the Make Maze button is clicked on memory management by the Java virtual machine (JVM) and the GUI as shown in Figs. 1 - 5. Linked lists, stack and priority hardware accelerated graphics rendering on performance and queue [5, 12] are used to store elements of the maze during its scalability. However, there are several Web-based resources construction. Queues and linked lists are used to store elements such as blogs, documentation, articles, and question and answer of the discovered path(s). sites that cover this specific topic, but present no data to compare memory utilization of the three Java graphics technologies. In The MakeMaze.java program prompts the user to enter the this paper, the data for heap memory utilization of the three file name and the width and height of the maze (in pixels) to be technologies collected by the author is presented and analyzed. displayed. The user is also prompted for the number of logical Results show, that greater the heap memory utilization, greater rows and columns of a 2D array data structure. The program are the effects of JVM’s memory management tasks of memory constructs the 2D array and initializes the value at every position allocation and deallocation on graphics rendering performance in it to zero. Each position is logically indexed by the and scalability. The reasons for it are discussed in this paper. intersection of a row and column of the 2D array. The first row from the top is row 0 and the first column from the left is column The paper is organized as follows. Section II describes the 0. The value at a particular position in the 2D array corresponds implementation details of the four programs and how they use to the color of a tile in the maze at relatively the same position. the Java graphics technologies. Section III contains performance Zeros represent the tiles in the boundaries (walls) which are evaluation. Section IV contains conclusions and future work. colored black.

II. SOFTWARE IMPLEMENTATION For the maze shown in Figs. 1 – 5, the user input was 20 for both the number of rows and columns of the 2D array. The A. Make Maze Program product of the number of rows and columns gives the maze size, The MakeMaze.java program constructs a maze using a i.e., the total number of tiles in the maze. Thus, the maze size is randomized version of the depth first search algorithm [11]. This 20 X 20 tiles. The maze is completely colored black initially, as algorithm is frequently implemented with a stack [5, 12]. As shown in Fig. 1, because every position in the array is initialized explained in the introduction above, the space for the maze is to zero. Figs. 2 - 5 show intermediate frames in the animation of logically divided into a grid of rectangular shaped cells, and a path construction in the maze after the Make Maze button is cell is called a tile. Beginning at a random tile, the program clicked. The program constructs the paths with ones. Ones selects a random neighboring tile to the left, top, right and represent the tiles in the paths. Tiles in the paths are colored light bottom that has not been visited. The program marks the new tile gray when first visited. They are colored white on backtracking. as visited, and pushes it onto the stack for the purpose of The program constructs n mazes using the array (the value backtracking [11]. The program continues this process until a tile of n is specified by the user), adds each maze to a linked list and with no unvisited neighbors is encountered. Such a tile is selects the one with the longest path area (greatest number of considered a dead-end. When a dead-end is encountered, the ones) using a priority queue and writes the ones and zeros row- program backtracks through the path it constructed until it by-row into a text file. The content of the text file is shown in reaches a tile with an unvisited neighbor, and continues the path Fig. 6. Each of the n mazes when constructed initially have the generation by visiting this unvisited tile, thus constructing a new same path length. To ensure different path lengths for each maze, junction. This process continues until every tile in the maze is zeros are randomly changed to ones before adding the maze to visited, causing the program to backtrack to the beginning tile the linked list. [11]. Selection of a tile in any of the four directions is done with equal probability. 1) Make Maze Algorithm The randomized depth first search algorithm for maze generation can be implemented using backtracking as follows [11]: Make the initial tile the current tile and mark it as visited While there are unvisited tiles

If the current tile has any neighbors which have not been visited Choose randomly one of the unvisited neighbors Push the current tile onto the stack Make the chosen tile the current tile and mark it as visited Else if the stack is not empty Pop a tile from the stack Make it the current tile 2) Make Maze Implementation Fig. 1. Initial state of maze.

1788

Fig. 2. After first nine tiles randomly visited.

Fig. 6. The values and relative positions corresponding to each tile are maintained in the text file. B. Maze Solution Programs The programs SolveMazeAWTSwing.java, SolveMazeFXFill.java and SolveMazeFXNodes.java use the same maze solution method. The programs prompt the user to enter the file name and the width and height of the maze (in pixels) to be displayed. The programs read the ones and zeros from the text file into a 2D array. The programs produce a graphical representation of the maze on the computer’s screen.

When a button is clicked the shortest path that leads in and out Fig. 3. After further path progression. of the maze is found. A stack and recursive backtracking are used to find the path(s) that leads in and out of the maze.

Recursive backtracking is a technique used in Artificial Intelligence applications that involve games, puzzles and maps. To solve a maze, recursive backtracking begins at a point of entry to the maze and then recursively explores all directions to find a path that lead outs of the maze. If a boundary wall, dead end or the exit is encountered, the recursive call returns (backtracks).

The progression of recursive backtracking along the paths of the maze is visualized using animation as shown in Figs. 7 - 11. The maze size is 48 X 48 tiles. The tiles in the paths that are being searched are dynamically highlighted with light gray as they are visited. Light gray tiles are dynamically re-colored Fig. 4. After the first instance of back tracking. white during backtracking. If a path is found out of the maze, it is highlighted with orange for 1 second. The shortest path will be highlighted in blue after all possible paths out of the maze are discovered. Once the shortest path is displayed, the maze is

solved.

1) Solve Maze with AWT and Swing To display the graphics frame containing the maze, the SolveMazeAWTSwing.java program uses the

java.awt.Graphics package [2]. The program calls the java.awt.Component.repaint method [2], which in turn generates a repaint event. This event asynchronously calls the programmer defined paintcomponent method to construct the graphics frame intended for display. The time gap between the calls to the java.awt.Component.repaint and paintcomponent methods is non-deterministic. This is because, the repaint event is processed Fig. 5. Final state of the maze.

1789 by adding it to the AWT event queue. Any other events queued Swing for hardware accelerated graphics. It should be noted, that earlier, must be processed before the repaint event. no such API has been used in the programs described in this The paintcomponent method is implemented by calling the paper for the purpose of evaluating the performance of the java.awt.Graphics.fillrect [2] method repeatedly. Each call to specific Java graphics technologies, namely AWT, Swing and java.awt.Graphics.fillrect paints a single tile in the maze in the JavaFX. program memory. Swing uses Java 2D software-based rendering where the CPU is used entirely for processing. This means that any programming logic that drives the state of the tiles in the next frame has to share CPU time. This effectively lowers the rate at which the frames can be displayed on the screen.

2) Solve Maze with JavaFX Graphics Context SolveMazeFXFill.java program calls a method named paint which is implemented by the author. This method is called synchronously, and it calls .scene.canvas.GraphicsContext.fillrect [7] instead of java.awt.Graphics.fillrect. JavaFX uses the GPU-based hardware accelerated graphics rendering pipeline called Prism, when supported graphics hardware is present. Prism’s Glass toolkit does not have an event queue like AWT, but instead uses the operating system's event queue to schedule threads [10]. The Prism rendering thread handles rendering separately from Glass. The low-level JavaFX rendering system allows for Fig. 7. Before the button Find Shortest Path is clicked. a number of rendering pipelines to do the real work [8]. Direct3D is used on . OpenGL is leveraged on , Mac, iOS, Android and Arm. With hardware accelerated rendering, the processing workload for rendering is offloaded from the CPU to the GPU. This means that any programming logic that drives the state of the tiles in the next frame can be concurrently processed by the CPU. This effectively increases the rate at which frames can be displayed on the screen. 3) Solve Maze with JavaFX Screen Graph SolveMazeFXNodes.java calls a method paint similar to SolveMazeFXFill.java and uses a scene graph to organize graphical objects. A scene graph provides a tree structure consisting of nodes. A node can have specific rendering instructions, and it can also contain child nodes. The SolveMazeFXNodes.java program constructs objects of the javafx.scene.shape.Rectangle class and adds them as nodes to the scene graph. The scene graph and list of observable objects [8] approaches are very popular today in vector-based rendering Fig. 8. Exploring a path out of the maze. applications. The graph or list is passed to the GPU based rendering pipeline. The advantage of this approach is it is useful for GUIs because hints for texturing, shadows, blurs, reflections, etc. can be passed via the graph or list to the GPU based rendering pipeline. A background thread can be used to construct and manipulate a scene graph, and the root node of the scene graph can be attached to an object in the scene. The scene graph can then be accessed from the JavaFX application thread. This enables developers to construct complex scene graphs on a background thread while keeping animations smooth and fast on the application thread [10]. AWT, Swing and JavaFX all use vector graphics [13] for shapes, because shapes require rasterization in the CPU (and passing a mask to the GPU in case of JavaFX). Bounds of the shape to be rasterized have a big impact on performance. Even though AWT and Swing do not use a GPU based rendering pipeline, API such as Java Binding for the OpenGL [14] and Lightweight Java Game Library [15] can be used with AWT and Fig. 9. Path exploration continues further.

1790 The software execution time was obtained using the Java System class’ nanoTime method and the heap memory profile was obtained using the Java Runtime class. Multiple warmup runs of paintcomponent and the two paint methods were carried out to negate any effects of the Java virtual machine (JVM), such as class loading and compiler optimization (such as branch prediction of conditional branching statements). B. Performance Metrics The following metrics were computed and plotted for each set of observations in order to evaluate the performance of each implementation: 1. Graphics frame rendering rate: The maximum number

of frames that can be rendered per second, measured in frames per second (FPS). Each frame contains the entire maze. The higher the frame rate, greater the possibility that the animation will be less choppy. The graphics frame rendering rate is one of the most critical Fig. 10. A path out of the maze is found. performance metrics because it measures what the viewer actually sees when the animation is played. 30FPS is widely considered minimum for smooth play, while 60FPS is considered a more premium rate and is the default frame rate cap of JavaFX for animation. 2. Heap memory utilization: The heap memory used by the program logic to solve the maze, measured in megabytes (MB). The larger the heap memory size, greater the possibility that JVM’s memory

management tasks for memory allocation and garbage collection (memory deallocation performed by the Java garbage collector (GC) [16]) will reduce the frame rate. The reasons for why this happen are explained in Section III.. Performance Analysis. Instead of repainting only the tiles that change color in each frame, all tiles in each frame are deliberately repainted. Also, in JavaFX, it is possible to tell the bitmap caching mechanism that Fig. 11. The shortest path out of the maze is found. particular nodes in the screen graph are animating, and should be painted directly from the bitmap cache without regenerating III. PERFORMANCE EVALUATION them [13]. These optimizations are not included in the programs Performance evaluation was undertaken on a 2018 MacBook so that the worst-case scenario is covered for performance Pro with 2.6 GHz 6-Core Intel Core i7 processor and 32 GB evaluation, where all the 2D shapes in an animation have to be 2400 MHz DDR4 RAM. The system has an Intel UHD Graphics repainted every frame. 630 1536 MB GPU. The profiling software and experiments C. Performance Analysis were implemented using Java version 11.0.1 and JavaFX version The graphics rendering frame rate for SolveMazeFXFill.java 11.0.2 on IDE version 4.10.0. is clearly the best of the three implementations and the A. Data Collection performance gap with respect to the other two implementations Data from two sets of observations were recorded. The data increases as the resolution of the displayed maze increases (as in each set of observations comprised of the execution time and seen in Fig. 12) and maze size increases (as seen in Fig. 14). For heap memory utilization for each of the paintcomponent and two the largest resolution of the displayed maze (1600 X 800 pixels), paint methods, and were recorded as follows. SolveMazeFXFill.java gives about 30% greater frame rate than 1.) For the first set of observations, maze size (number of SolveMazeAWTSwing.java. For the largest maze size (72 X 72 tiles) was kept constant at 48X48 tiles and resolution of tiles), SolveMazeFXFill.java gives nearly 4.5 times the frame the displayed maze (number of pixels), was varied for rate of SolveMazeAWTSwing.java. As noted in section II, the 250X250 pixels, 500X500 pixels, 750X750 pixels and time gap between the calls to the java.awt.Component.repaint 1600X800 pixels. method and programmer defined paintcomponent method is 2.) For the second set of observations, resolution of the non-deterministic. This time gap is overhead to the execution displayed maze, was kept constant at 500X500 pixels time of paintcomponent and is not considered in the plots of and maze size was varied for 48X48 tiles, 52X52 tiles, SolveMazeAWTSwing.java as shown in Figs. 12 and 14. This 60X60 tiles and 72X72 tiles. time gap can be as high as 1.5 milliseconds. Therefore, the frame

1791 rate of SolveMazeAWTSwing.java is even less because of the additional overhead to process the repaint event.

The superior performance of SolveMazeFXFill.java is because JavaFX supports hardware acceleration for graphics rendering. In hardware accelerated rendering, a large portion of the processing work load is transferred from the CPU to the GPU. On Mac, OpenGL is leveraged for this purpose. The hardware acceleration can be observed using a system resource monitor called the Activity Monitor on Mac. For the largest maze size, the CPU utilization of SolveMazeAWTSwing.java is twice of SolveMazeFXFill.java and two-thirds of

SolveMazeFXNodes.java. SolveMazeAWTSwing.java also shows zero GPU utilization, while SolveMazeFXFill.java shows a GPU utilization of 0.3% and SolveMazeFXNodes.java shows a GPU utilization of 0.8%. This is because, by default Swing Fig. 13. Heap memory used to solve the maze (MB) Vs Resolution of maze displayed on screen (Pixels). does not support hardware acceleration and the CPU has to carry the entire processing workload for graphics rendering. As mentioned above, JavaFX supports hardware acceleration. However, in spite of hardware acceleration, for SolveMazeFXNodes.java, CPU utilization is greater than the other two programs, SolveMazeFXFill.java and SolveMazeAWTSwing.java. SolveMazeFXNodes.java also gives relatively very poor frame rate when compared to the other two implementations. Its greater CPU utilization and poor frame rate is because of the memory allocation of the rectangle drawing objects (for the maze tiles) that are constructed and added to the screen graph as children nodes. This allocation consumes the memory of the thread local allocation buffer and has to continue onto the heap.

The thread local allocation buffer [17] is a local cache block for Fig. 14. Graphics frame rendering rate (FPS) Vs Size of maze the thread and is allocated from the heap. This cache block is rendered (Tiles). called a thread local heap (TLH). Objects are allocated from the TLH without the need to acquire the heap lock, and therefore, this type of allocation (cache allocation) is very efficient. However, because the TLH size is limited (up to a maximum of 128KB), construction of multiple objects will tend to overrun this memory and objects will have to be allocated on the heap (heap lock allocation), which is less efficient because of the need to acquire the heap lock. This means, it takes more time to generate the base image of the maze through the screen graph, before it is offloaded to the GPU. Thus, not only negating any performance gain from hardware acceleration, but also further reducing the frame rate.

Fig.15. Heap memory used to solve the maze (MB) Vs Size of maze rendered (Tiles). As shown in Figs. 13 and 15, the heap memory utilization for solving the maze remains more or less constant for each program. Except, there is a sudden spike in heap memory utilization for the largest maze size considered, which amounts to over 50 times increment for SolveMazeAWTSwing.java, 20 times for SolveMazeFXFill.java and 10 times for SolveMazeFXNodes.java. SolveMazeFXNodes.java uses on average 3 times the heap memory of SolveMazeFXFill.java and  10 times the heap memory of SolveMazeAWTSwing.java. An Fig. 12. Graphics frame rendering rate (FPS) Vs Resolution of interesting result is that the memory utilization for maze displayed on screen (Pixels). SolveMazeFXFill.java is the least of the three implementations

1792 for the largest maze size (nearly 25% less). This means, for alleviated by increasing the stack memory size by passing SolveMazeFXFill.java there is less heap lock allocation than the appropriate parameters to the JVM, or by replacing the recursive other two implementations. Also, the greater heap memory solution with an iterative one, where a software stack is utilization of the other two implementations means that there is constructed and used by the program. However, the problem of greater possibility of the GC running thus increasing CPU the execution time being prohibitive still remains. utilization. That is why the frame rate of SolveMazeFXFill.java is not affected, while the frame rates of the other two IV. CONCLUSION AND FUTURE WORK implementations decrease, thus increasing the performance gap. In conclusion, JavaFX with graphics context object performs The GC is run automatically and periodically by the JVM. It can better with respect to graphics rendering frame rate, memory be invoked using the Runtime class, but is non-deterministic, utilization and scalability than JavaFX with scene graph and which means the exact start time of execution cannot be Java AWT and Swing when rendering 2D mazes with a large predicted. The frequency of its invocation by the JVM tends to number of tiles. Less memory utilization results in less heap lock increase as heap memory utilization approaches the total heap allocation and less possibility of the GC running. This effect on memory size. This is because, due to fragmentation it becomes the GC results in less CPU utilization, leaving more time for less likely to find enough contiguous heap memory space to store program logic. Based on the observations and conclusions, it is an object, especially if the object is large. When enough possible to hypothesize that JavaFX with graphics context will contiguous memory space is not found, the JVM runs the GC to also perform better for animation of scenes with a large number delete all objects that are not referenced in the program in order of different 2D geometric shapes interacting constantly. to free-up memory space. For future work, a 3D animated maze solution can be Overall the data clearly shows that SolveMazeFXFill.java developed with JavaFX, and the 3D graphics rendering performs best of all three programs with respect to frame rate performance can be evaluated. and memory utilization. Also, its performance scales better as the resolution of the displayed maze and maze size increase. REFERENCES It should be noted that the program logic that solves the maze [1] Wikipedia The Free Encyclopedia, Abstract Window Toolkit, 2020, URI:https://en.wikipedia.org/wiki/Abstract_Window_Toolkit using recursive backtracking, was not included in the timing [2] Java Platform Version 15 API Specification, Package java.awt, 2020, measurements in order to focus entirely on the rendering URI:https://docs.oracle.com/en/java/javase/15/docs/api/java.desktop/jav performance of the graphics technologies. Also, animation in the a/awt/package-summary.html programs is implemented using a multithreaded approach that [3] Wikipedia The Free Encyclopedia, Swing (Java), 2020, incorporates timing delays of the order of milliseconds to set the URI:https://en.wikipedia.org/wiki/Swing_(Java) frame rate. These delays can also be set to 0 milliseconds when [4] Java Platform Version 15 API Specification, Package javax.swing, 2020, required. That is why the frame rates in the graphs for URI:https://docs.oracle.com/en/java/javase/15/docs/api/java.desktop/jav SolveMazeAWTSwing.java and SolveMazeFXFill.java are so ax/swing/package-summary.html high. Higher the frame rate in the graphs, means it took less time [5] Y. D. Liang, “Introduction to Java Programming and Data Structures,” to render a frame. This also means, for good quality animation Comprehensive Version, Eleventh Edition. Pearson, 2017 (at least 30FPS), more time will be left over for program logic if [6] Wikipedia The Free Encyclopedia, JavaFX, 2020, the frame rate is higher to begin with. By including the program URI:https://en.wikipedia.org/wiki/JavaFX#JavaFX_2.0 logic, a frame rate of 100FPS is easily possible for all three [7] OpenJFX, JavaFX 15 Modules, 2020, URI:https://openjfx.io/javadoc/15/ programs to render a maze of size 48 X 48 tiles with the [8] J. Vos, “Taking a closer look at JavaFX,” jaxenter, 2017, URI:https://jaxenter.com/taking-closer-look-javafx-134565.html resolution of the displayed maze being 500 X 500 pixels, giving [9] J. Stafford, “Pros, cons of moving from Swing to JavaFX: UI tools a plus,” good quality animation. However, because The Server Side, 2013, URI:https://www.theserverside.com/feature/Pros- SolveMazeAWTSwing.java and SolveMazeFXNodes.java are cons-of-moving-from-Swing-to-JavaFX-UI-tools-a-plus relatively CPU intensive, any program logic that changes the [10] C. Castillo, “JavaFX Architecture,” JavaFX Architecture and position, size, color or other attributes of the 2D geometric Framework, Release 2.2.21, 2013, URI: shapes in the next frame and is also CPU intensive will adversely https://docs.oracle.com/javafx/2/architecture/jfxpub-architecture.htm affect the frame rate more than SolveMazeFXFill.java as the [11] Wikipedia The Free Encyclopedia, Maze generation algorithm, 2020, maze size increases. URI:https://en.wikipedia.org/wiki/Maze_generation_algorithm [12] C. A. Shaffer, “A Practical Introduction to Data Structures and Algorithm For mazes with size approaching 100 X 100 tiles and having Analysis,” Second Edition, Prentice Hall, 2001 multiple paths to the outside, the execution time of the program [13] OpenJDK Wiki, Performance Tips and Tricks, 2020, URI: logic to solve the maze becomes prohibitive even for https://wiki.openjdk.java.net/display/OpenJFX/Performance+Tips+and+ SolveMazeFXFill.java. With increase in the number of paths to Tricks the outside for a 100 X 100 tiles maze, the possibility of [14] Wikipedia The Free Encyclopedia, Java Bindings for OpenGL, 2020, encountering a stack overflow error also increases. A stack URI:https://en.wikipedia.org/wiki/Java_Bindings_for_OpenGL overflow error occurs when the recursive depth is large enough, [15] Wikipedia The Free Encyclopedia, Lightweight Java Game Library, 2020, such that the number of recursive calls result in the total memory URI:https://en.wikipedia.org/wiki/Lightweight_Java_Game_Library [16] Oracle Learning Library, Java Garbage Collection Basics, 2020, URI: of the stack frames overflowing the stack memory allocated to https://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/i the program. In Java, each method invocation results in the local ndex.html variables of the calling method to be dumped onto the stack. The [17] IBM Knowledge Center, Memory Management, 2020, URI: portion of memory allocated on the stack for this purpose is https://www.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/com.ib called a stack frame. The stack overflow problem can be m.java.vm.80.doc/docs/mm_memory_management.html

1793