View Article

Abstract

In this paper, the usage of the A* pathfinding algorithm for the implementation and performance of both Python and Java are being compared. The research focuses on the time taken for executing programs, space complexity, and scalability where different tests have been done on datasets of varying sizes and difficulty. Python is comprehensive and fast in development; therefore, it is ideal for the creation of a proof of concept and less complex applications. However, due to its interpretation property, it is more complex than other algorithms to work with large volumes of data and applications in real-time. Java is based on writing compiling, and statically typed language which gives the advantage of quicker execution and improved memory management, which makes the language more suitable for applications that are more sensitive to performance. The activities are to provide A* in two languages, to perform experiments with different test cases, as well as to evaluate performance indices. Issues of ethics about increase in availability, equity, and sustainability are also touched on. In this regard, the study wants to help the developers identify the most appropriate language depending on the application.

Keywords

A* Algorithm, Heuristic search, Time complexity, Space complexity

Introduction

The A* algorithm is widely known as one of the best path-finding and graph traversal algorithms in several disciplines, from video games to robotics. Here in this study, we look into the A* search algorithm and its implementation using two popular programming languages i.e. Python and Java. This work aims to contrast the performance characteristics of A* between these two languages and shed some light on which one is better than or worse at in which use case. So the developers can select a programming language as per their use case after analysis given here. The A* uses heuristics to guide which paths are examined, making it much more efficient than uninformed search algorithms. In this scenario, it will find the best solution, which has made it a common algorithm in some areas like Geographic Information Systems (GIS), game development, and artificial intelligence.

Reference

  1. Abdulkareem, S.A. and Abboud, A.J., 2021, February. Evaluating Python, c++, JavaScript, and Java programming languages based on software complexity calculator (Halstead metrics). In IOP Conference Series: Materials Science and Engineering (Vol. 1076, No. 1, p. 012046). IOP Publishing.
  2. Agha, F.A. and Nawaz, H., 2021. Comparison of bubble and insertion sort in Rust and Python language. Internat. l J, 10, p.2.Ahmad, I., 2020. 40 Algorithms Every Programmer Should Know: Hone your problem-solving skills by learning different algorithms and their implementation in Python. Packt Publishing Ltd.
  3. Alexiadis, V., 2024. Graph-based Machine Learning: Applications, Challenges and Case Study.
  4. Almutairi, H. and Zhang, N., 2024. A Survey on Routing Solutions for Low-Power and Lossy Networks: Toward a Reliable Path-Finding Approach. Network, 4(1), pp.1-32.
  5. Aqib, S.M., Nawaz, H. and Butt, S.M., 2021. Analysis of merge sort and bubble sort in Python, PHP, JavaScript, and c language. International Journal, 10(2).
  6. Bahar, A.Y., Sherman, S.M., Khder, M.A., Quadir, A.M. and Almosawi, S.A., 2022, June. Survey on features and comparisons of programming languages (PYTHON, JAVA, AND C#). In 2022 ASU International Conference in Emerging Technologies for Sustainability and Intelligent Systems (ICETSIS) (pp. 154-163). IEEE.
  7. Basselin, J., Alonso, L., Ray, N., Sokolov, D., Lefebvre, S. and Lévy, B., 2021, May. Restricted power diagrams on the GPU. In Computer Graphics Forum (Vol. 40, No. 2, pp. 1-12).
  8. Belgaid, M.C., 2022. Green coding: an empirical approach to harness the energy consumption of software services (Doctoral dissertation, Université de Lille).
  9. Brown Requist, K. and Momayez, M., 2024. Minimum Cost Pathfinding Algorithm for the Determination of Optimal Paths under Airflow Constraints. Mining, 4(2), pp.429-446.
  10. Coletti, M.A., Scott, E.O. and Bassett, J.K., 2020, July. Library for evolutionary algorithms in Python (LEAP). In Proceedings of the 2020 Genetic and Evolutionary Computation Conference Companion (pp. 1571-1579).
  11. David, D., Alamoodi, A.H., Albahri, O.S., Zaidan, B.B., Zaidan, A.A., Garfan, S., Ismail, A.R., Albahri, A.S., Alsinglawi, B. and Malik, R.Q., 2024. Landscape of sign language research based on smartphone apps: coherent literature analysis, motivations, open challenges, recommendations and future directions for app assessment. Universal Access in the Information Society, 23(2), pp.687-702.
  12. Dhalla, H.K., 2020, November. Performance analysis of native JSON parsers in Java, Python, and ms. net core, javascript, and php. In 2020 16th International Conference on Network and Service Management (CNSM) (pp. 1-5). IEEE.
  13. Durrani, O.K. and Abdulhayan, S., 2022, November. Performance Measurement of Popular Sorting Algorithms Implemented using Java and Python. In 2022 International Conference on Electrical, Computer, Communications and Mechatronics Engineering (ICECCME) (pp. 1-6). IEEE.
  14. Dymora, P. and Paszkiewicz, A., 2020. Performance analysis of selected programming languages in the context of supporting decision-making processes for Industry 4.0. Applied Sciences, 10(23), p.8521.
  15. Evans, K.M., Lausberg, C. and How, J.S.S., 2019. Reducing the property appraisal bias with decision support systems: An experimental investigation in the South African property market. Journal of African Real Estate Research, 4(1), pp.108-138.
  16. Foead, D., Ghifari, A., Kusuma, M.B., Hanafiah, N. and Gunawan, E., 2021. A systematic literature review of A* pathfinding. Procedia Computer Science, 179, pp.507-514.
  17. Gibb, G., Nash, R., Brown, N. and Prodan, B., 2019, November. The technologies required for fusing HPC and real-time data to support urgent computing. In 2019 IEEE/ACM HPC for Urgent Decision Making (UrgentHPC) (pp. 24-34). IEEE.
  18. Gmys, J., Carneiro, T., Melab, N., Talbi, E.G. and Tuyttens, D., 2020. A comparative study of high-productivity high-performance programming languages for parallel metaheuristics. Swarm and Evolutionary Computation, 57, p.100720.
  19. Gorelick, M. and Ozsvald, I., 2020. High-Performance Python: Practical Performant Programming for Humans. O'Reilly Media.
  20. Guo, P., 2021, October. Ten million users and ten years later: Python tutor’s design guidelines for building scalable and sustainable research software in academia. In The 34th Annual ACM Symposium on User Interface Software and Technology (pp. 1235-1251).
  21. Khoirom, S., Sonia, M., Laikhuram, B., Laishram, J. and Singh, T.D., 2020. Comparative analysis of Python and Java for beginners. Int. Res. J. Eng. Technol, 7(8), pp.4384-4407.
  22. Kitchin, R., 2019. Thinking critically about and researching algorithms. In The social power of algorithms (pp. 14-29). Routledge.
  23. Kummita, S., Piskachev, G., Späth, J. and Bodden, E., 2021, March. Qualitative and quantitative analysis of callgraph algorithms for Python. In 2021 International Conference on Code Quality (ICCQ) (pp. 1-15). IEEE.
  24. Li, Y. and Jiang, Z.M., 2019. Assessing and optimizing the performance impact of the just-in-time configuration parameters-a case study on PyPy. Empirical Software Engineering, 24, pp.2323-2363.
  25. Lion, D., Chiu, A., Stumm, M. and Yuan, D., 2022. Investigating Managed Language Runtime Performance: Why {JavaScript} and Python are 8x and 29x slower than C++, yet Java and Go can be Faster? In 2022 USENIX Annual Technical Conference (USENIX ATC 22) (pp. 835-852).
  26. Ma, Y., Mockus, A., Zaretzki, R., Bradley, R. and Bichescu, B., 2020. A methodology for analyzing the uptake of software technologies among developers. IEEE Transactions on Software Engineering, 48(2), pp.485-501.
  27. Memeti, S., Pllana, S., Binotto, A., Ko?odziej, J. and Brandic, I., 2019. Using meta-heuristics and machine learning for software optimization of parallel computing systems: a systematic literature review. Computing, 101, pp.893-936.
  28. Michail, D., Kinable, J., Naveh, B. and Sichi, J.V., 2020. JGraphT—A Java library for graph data structures and algorithms. ACM Transactions on Mathematical Software (TOMS), 46(2), pp.1-29.
  29. Mohanraj, S., 2019. Performance of buckets versus min-heap in the A* search algorithm (Master's thesis, University of Windsor (Canada)).
  30. Naveed, M.S., 2021. ‘Comparison of C++ and Java in implementing introductory programming algorithms. Quaid-E-Awam Univ. Res. J. Eng. Sci. Technol, 19(1), pp.95-103.
  31. Nowicki, M., Górski, ?. and Ba?a, P., 2020, August. Performance evaluation of Java/PCJ implementation of parallel algorithms on the cloud. In European Conference on Parallel Processing (pp. 213-224). Cham: Springer International Publishing.
  32. Osaba, E., Villar-Rodriguez, E., Del Ser, J., Nebro, A.J., Molina, D., LaTorre, A., Suganthan, P.N., Coello, C.A.C. and Herrera, F., 2021. A tutorial on the design, experimentation and application of metaheuristic algorithms to real-world optimization problems. Swarm and Evolutionary Computation, 64, p.100888.
  33. Prokopec, A., Rosà, A., Leopoldseder, D., Duboscq, G., T?ma, P., Studener, M., Bulej, L., Zheng, Y., Villazón, A., Simon, D. and Würthinger, T., 2019, June. Renaissance: Benchmarking suite for parallel applications on the jvm. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation (pp. 31-47).
  34. Saabith, A.S., Vinothraj, T. and Fareez, M., 2020. Popular python libraries and their application domains. International Journal of Advance Engineering and Research Development, 7(11).
  35. Schmitt, N., Kamthania, S., Rawtani, N., Mendoza, L., Lange, K.D. and Kounev, S., 2021, November. Energy-efficiency comparison of common sorting algorithms. In 2021 29th International Symposium on Modeling, Analysis, and Simulation of Computer and Telecommunication Systems (MASCOTS) (pp. 1-8). IEEE.
  36. Spiegelberg, L., Yesantharao, R., Schwarzkopf, M. and Kraska, T., 2021, June. Tuplex: Data science in python at native code speed. In Proceedings of the 2021 International Conference on Management of Data (pp. 1718-1731).
  37. Su, P., Wang, Q., Chabbi, M. and Liu, X., 2019, August. Pinpointing performance inefficiencies in Java. In Proceedings of the 2019 27th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering (pp. 818-829).
  38. Vandewiele, G., Steenwinckel, B., Agozzino, T. and Ongenae, F., 2022. pyrdf2vec: A python implementation and extension of rdf2vec. arXiv preprint arXiv:2205.02283.
  39. Welch, J. and Walter, J., 2022. Link reversal algorithms. Springer Nature.
  40. Wengner, M. and Souza, B., 2023. Practical Design Patterns for Java Developers: Hone your software design skills by implementing popular design patterns in Java. Packt Publishing Ltd.
  41. Wu, B., 2021, August. K-means clustering algorithm and Python implementation. In 2021 IEEE International Conference on Computer Science, Artificial Intelligence and Electronic Engineering (CSAIEE) (pp. 55-59). IEEE.
  42. Yan, C., Xiang, X. and Wang, C., 2020. Towards real-time path planning through deep reinforcement learning for a UAV in dynamic environments. Journal of Intelligent & Robotic Systems, 98, pp.297-309.

Photo
Ruma Dutta
Corresponding author

upGrad Education Pvt Ltd, Mumbai

Photo
Sandeep Arumugam
Co-author

upGrad Education Pvt Ltd, Mumbai

Ruma Dutta*, Sandeep Arumugam, Performance Characteristics of the A* Algorithm in Python and Java, Int. J. Sci. R. Tech., 2026, 3 (3), 191-203. https://doi.org/10.5281/zenodo.18934341

More related articles
Bioremediation of Polychlorinated Biphenyls- Impac...
Dibyarupa Pal, Koly Dey, Barsha Das, ...
Pharmacological Innovations in The Treatment of Ga...
Tushar Kawale, Shraddha Bandagi, Bhagyashree Dane, Kalyani Jamdad...
Multiple Bilateral Supplemental Premolars in Non-S...
Dr. Shilpi Srivastava, Dr. Durga Shankar Gupta, Dr. Shilpi Srivas...
Related Articles
Amyotrophic Lateral Sclerosis: A Comprehensive Review of Pathophysiology, Clinic...
Arnab Roy, Shruti Kumari , Bindu Kumari , Abhinav Kumar , Divya Kumari , Indu Sharma , Ashish Kumar...
Artificial Intelligence in Medication Adherence and Personalized Treatment Plans...
Akanksha Kukade , Sayali Kawade , Sonakshi Lokare , Ankita Kharage , ...
Emerging Multidrug-Resistant Fungal Pathogens: Epidemiology, Mechanisms, and Nov...
Haider Abbas, Amulya Singh, Arpit Maurya , Kavya Singh, Dr. Anupam Singh, ...
More related articles
Pharmacological Innovations in The Treatment of Gastrointestinal Disorders: A Co...
Tushar Kawale, Shraddha Bandagi, Bhagyashree Dane, Kalyani Jamdade, ...
Multiple Bilateral Supplemental Premolars in Non-Syndromic Patients- Report of T...
Dr. Shilpi Srivastava, Dr. Durga Shankar Gupta, Dr. Shilpi Srivastava, ...
Pharmacological Innovations in The Treatment of Gastrointestinal Disorders: A Co...
Tushar Kawale, Shraddha Bandagi, Bhagyashree Dane, Kalyani Jamdade, ...
Multiple Bilateral Supplemental Premolars in Non-Syndromic Patients- Report of T...
Dr. Shilpi Srivastava, Dr. Durga Shankar Gupta, Dr. Shilpi Srivastava, ...