3 ms·
I'll give two examples of code I could for sure write myself but that I had gpt4 write for me because I figured it would be faster (and it was). The first one
by montecarl 4y ago
I'll give two examples of code I could for sure write myself but that I had gpt4 write for me because I figured it would be faster (and it was).
The first one was to write a python script to watch a list of files given as cmd line arguments and plot their output anytime one of the files changed. It wrote a 100 line python script with nice argument parsing to include several options (like title and axes labels). It has one tiny bug in it that took a couple of minutes to fix. When I pointed out the bug it was able to fix it itself (had to do with comparing relative to abs file paths). If I wrote the script myself I would not have made something general purpose and it would have taken maybe 30 minutes to do.
The second example required no fixing and appears bug free. I asked it to write a python function to take a time trace, calculate and plot the FFT, then apply FFT low pass filtering, and then also plot the filtered time signal vs the original. This is all straight forward numpy code but I don't work with FFTs often and would have had to lookup a bunch of different API docs. Way faster.
I have also had it write some c macros for me, since complex C macros can be hard to escape properly and I'm not comfortable with the syntax. Its 100% successful there.
- brundolf 4y agoYeah, so I think all of these fall under that category I mentioned (the first one may or may not for you, but it would for me because I don't work with Python much): most of the time saved is in looking up a bunch of things to assemble together, not ideating and writing out the logic. I can see this kind of codegen being useful in special situations, but it wouldn't really be useful in my day-to-day work because almost by definition I'm very familiar with the technologies I use every day