TypedDevs / bashunit

A simple testing library for bash scripts. Test your bash scripts in the fastest and simplest way, discover the most modern bash testing library.
https://bashunit.typeddevs.com
MIT License
270 stars 21 forks source link

Optimize bashunit #228

Closed antonio-gg-dev closed 7 months ago

antonio-gg-dev commented 7 months ago

📚 Description

By removing the call to the deprecated setUp/tearDown functions and modifying the implementation of the execute_function_if_exists and unset_if_exists helpers, I've managed to reduce the execution time of the library's own tests by around 15% in my local environment.

To calculate these times, I have been running the following script while making changes and taking an average of the times:

for i in {1..10}; do make test | grep "Time taken: " >> result_2_f; done

After all the changes, the results I have obtained from main vs this branch are as follows: imagen

Removing the deprecations meant a reduction of about 5%, and modifying the implementation of the helpers accounted for the remaining 10% reduction.

🔖 Changes

✅ To-do list