At work, most of the code I produce will take in a lot of data – usually in a csv file – and then format and filter it to the specifications of whoever needs the report. I have developed a template in python that will split the data and store each piece in an object. The class usually has to be tweaked per report. What I like about this is that once I have all the data in this format within the program I know that I can pretty much do anything I want with it and know where each piece of data is, how to access it, how to modify it, and how to get it to interact with other pieces of data.
As a fun exercise I re-wrote one of my scripts in Raku which I’ve been learning in another class. I did this because I have been having a lot of fun with Raku and wanted to keep learning it and regular expressions, and because I wanted to see how it would measure up performance wise with my Python solution. My Raku solution I know was not very optimized, because there was a point I couldn’t access a certain hash value and I couldn’t figure it out. So I split the outer hash value using regex and looped through the resulting array. I don’t know for sure but I don’t think that’s a pretty solution. Even with this non optimal Raku, it still ran almost 10x faster than my Python code. I’m not at the point where I need a perfectly optimized solution, but it did make me wonder about what that point is? If a python script took 8 hours to run and the same raku script took 1, then the extra time it would take me as a raku novice to write the script would easily be made up for in performance. When is the performance benefit of an unfamiliar but better tool worth it over something I’m familiar with and can complete quickly? In any case, I’m having a lot of fun with Raku and will try to continue improving with it at work.