# A Comparative Analysis for Optimizing Machine Learning Model Deployment in IoT Devices
## 2 Related Work  
In recent years, there has been much work done on determining an optimal method to train and deploy ML models on the edge device [1]. Subsequently, the selection of the programming language on the device considerably affects elements like execution speed, energy efficiency, and code complexity. This literature assessment explores the studies landscape concerning Raspberry Pi and programming languages, inspecting how language choice affects performance, complexity, and energy consumption. Early studies laid the foundation for comparing the performance of compiled and translated languages. Compiled languages, such as C and C++, exhibit better execution speeds due to direct interpretation in machine code; interpreted languages, such as Python, rely on runtime interpretation; and tasks that require more computation [2; 3; 4] perform more slowly. Furthermore, the analysis of image classification methods revealed the computational efficiency of the C# implementation on Python, albeit at a higher computational cost [3]. Beyond the compiled vs. interpreted arguments, recent research has delved into the performance differences between specific programming languages. Comparative analyses consistently showcase the faster execution speed of C++ over Python, attributing this difference to C++'s lower-level nature [5]. Empirical comparisons between various languages emphasize scripting languages' development speed advantage, albeit with increased memory consumption [6]. Attempts to analyze energy consumption in programming languages find that compiled languages are more energy efficient than interpreted languages. Source code optimization emerges as an important factor affecting energy efficiency and performance [7]. The complexity of development is another factor to consider. Python appears as the simplest and easiest language, while C++ and Java are considered the most complex [8]. The optimization of energy efficiency and performance is important when it is a resource-constrained environment like IoT devices and microcontrollers. Edge machine learning techniques and advances in tinyML computer vision applications provide promising ways to achieve this goal [9; 10]. Studies focusing on Raspberry Pi applications underscore the importance of more efficient and effective code for these devices [11; 12; 13]. Manual optimization methods are often more effective than automated compiler optimization, emphasizing the need for customized methods [14]. For performance-critical tasks, studies suggest that compiled languages like C or C++ might be preferable. Moreover, using optimization techniques and energy-efficient languages is recommended when energy consumption is a concern [15]. Performance analysis in microcontrollers reveals the capabilities of programming languages for data processing tasks. C and C++ have better performance than other languages, while MicroPython exhibits slower execution times, limiting its suitability for high-performance applications [16]. Noticeable trends in the literature emphasize the importance of resource-constrained environments such as IoT devices. Pre-trained models and edge machine learning techniques offer promising approaches to improve energy efficiency and reduce communication costs in these environments [16; 17; 18]. Furthermore, the concepts of \"green coding\" [19; 20] and \"carbon footprint\" [21] emphasize the need for sustainable coding practices to reduce the environmental impact of computers. They focus on the importance of considering energy efficiency and environmental sustainability in software development [16; 22; 23]. Table 1 presents a gap analysis comparing existing works with the contributions of our study. On-device execution was not considered. The ML algorithms used were shallow algorithms due to the structured dataset in use providing the energy efficiency of a building instead of the IoT device constructing the system. We have provided an in-depth analysis of on-device power consumption and its environmental impact on a particular device.