Runtime hotspots in Java applications are usually chased down by intuition rather than by measurement. This study profiles three applications chosen to represent three structurally different hotspot categories: a Sudoku backtracking solver that is algorithmic and CPU-bound, a headless Snake simulation that is allocation-bound, and an invoice generator dominated by string building and file input/output. JDK Flight Recorder is the only profiling instrument used, and each hotspot receives a refactoring matched to its category. Execution time is measured independently across ten iterations per configuration and improves significantly in every application, by 38.7 percent for the invoice generator, 52.1 percent for the solver and 67.4 percent for the simulation. Peak heap, allocation rate and garbage-collection pause time are drawn from a single aggregated recording per configuration, so they are presented as descriptive point estimates and carry no significance test, and CPU time is reported as a proxy equal to execution time because no independent instrumentation was implemented. The invoice generator improves on all five metrics and rests on the largest volume of underlying events. The other two applications each yield one result opposing the direction their refactoring targeted, which the present recording design cannot separate from sampling artefact. Every refactoring was validated against byte-identical output before measurement began. The work shows that a profiler-first workflow reliably identifies and removes hotspots, while also demonstrating how measurement design determines which performance claims a study can legitimately support.
This paper tested a profiler-guided workflow built on JDK Flight Recorder across three Java applications representing different hotspot categories. All three refactorings were validated for functional equivalence, through byte-identical output under a fixed workload or seed, before any performance measurement was taken. Execution time, the only metric measured with independent per-iteration variance, improved significantly in every application, with gains between 38.7 and 67.4 percent. Peak heap, allocation rate and pause time were measured from a single aggregated recording per configuration and are reported as descriptive point estimates. Two of those point estimates ran counter to the direction the corresponding refactoring targeted, namely an increase in the solver’s peak heap and an increase in the simulation’s pause time, and the present design cannot establish whether either is a real effect or an artefact of a short recording containing very few events.
References
[1] Oracle Corporation, âJava Platform, Standard Edition Flight Recorder API Programmerâs Guide, Release 21,â Oracle Corporation, Redwood Shores, CA, USA, 2023. [Online]. Available: https://docs.oracle.com/en/java/javase/21/jfapi/ [2] VisualVM: All-in-One Java Troubleshooting Tool, 2023. [Online]. Available: https://visualvm.github.io/ [3] R. Pereira, M. Couto, F. Ribeiro, R. Rua, J. Cunha, J. P. Fernandes, and J. Saraiva, âRanking Programming Languages by Energy Efficiency,â Science of Computer Programming, vol. 205, 2021, Art. no. 102609. [4] C. Sahin, L. Pollock, and J. Clause, âHow Do Code Refactorings Affect Energy Usage?,â Proceedings of the 8th ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM), Torino, Italy, pp. 1-10, 2014. [5] C. Sahin, M. Wan, P. Tornquist, R. McKenna, Z. Pearson, W. G. J. Halfond, and J. Clause, âHow Does Code Obfuscation Impact Energy Usage?,â Journal of Software: Evolution and Process, vol. 28, no. 7, pp. 565-588, 2016. [6] S. Dieckmann, and U. HĂślzle, âA Study of the Allocation Behavior of the SPECjvm98 Java Benchmarks,â Proceedings of the 13th European Conference on Object-Oriented Programming (ECOOP), Lecture Notes in Computer Science, vol. 1628, Berlin, Germany: Springer, pp. 92-115, 1999. [7] S. M. Blackburn, P. Cheng, and K. S. McKinley, âMyths and Realities: The Performance Impact of Garbage Collection,â Proceedings of the Joint International Conference on Measurement and Modeling of Computer Systems (SIGMETRICS/Performance), New York, NY, USA, pp. 25-36, 2004. [8] D. Detlefs, C. Flood, S. Heller, and T. Printezis, âGarbage-First Garbage Collection,â Proceedings of the 4th International Symposium on Memory Management (ISMM), Vancouver, BC, Canada, pp. 37-48, 2004. [9] P. Runeson, and M. HĂśst, âGuidelines for Conducting and Reporting Case Study Research in Software Engineering,â Empirical Software Engineering, vol. 14, no. 2, pp. 131-164, 2009. [10] A. Georges, D. Buytaert, and L. Eeckhout, âStatistically Rigorous Java Performance Evaluation,â Proceedings of the 22nd Annual ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA), Montreal, QC, Canada, pp. 57-76, 2007. [11] T. Kalibera, and R. E. Jones, âRigorous Benchmarking in Reasonable Time,â Proceedings of the 2013 International Symposium on Memory Management (ISMM), Seattle, WA, USA, pp. 63-74, 2013. [12] T. Mytkowicz, A. Diwan, M. Hauswirth, and P. F. Sweeney, âProducing Wrong Data Without Doing Anything Obviously Wrong!,â Proceedings of the 14th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), Washington, DC, USA, pp. 265-276, 2009. [13] C. Wohlin, P. Runeson, M. HĂśst, M. C. Ohlsson, B. Regnell, and A. WesslĂŠn, Experimentation in Software Engineering, Berlin, Germany: Springer, 2012. [14] M. Fowler, Refactoring: Improving the Design of Existing Code, 2nd ed., Boston, MA, USA: Addison-Wesley, 2018. [15] L. Cruz, and R. Abreu, âCatalog of Energy Patterns for Mobile Applications,â Empirical Software Engineering, vol. 24, no. 4, pp. 2209-2235, 2019. [16] A. Noureddine, âPowerJoular and JoularJX: Multi-Platform Software Power Monitoring Tools,â Proceedings of the 18th International Conference on Intelligent Environments (IE), Biarritz, France, 2022.
đ How to Cite This Paper
Sumit Kumar, Jasvir Singh (2026). Profiler-Guided Detection and Refactoring of Runtime Hotspots in Java Applications. International Journal of Computer Science Engineering Techniques, 10(4), 87â94. ISSN: 2455-135X. DOI: https://doi.org/10.5281/zenodo.22032312