Has anyone else noticed that just writing Python code seems to be draining their laptop battery twice as fast? I'm not even running any scripts—just typing away in VS Code on Pop!_OS. I'm new to Python, so I hope this isn't a silly question with no real answer. I've disabled any unnecessary features like Pylance, checked my CPU usage (it's under 5%), and turned off my dedicated GPU. My RAM usage is around 10GB, which is about a third of my 32GB total. Despite all this, my laptop is noticeably hotter while coding in Python. Interestingly, I don't have this problem when I'm doing web development with JavaScript and React. Can anyone shed some light on what's causing this battery drain?
1 Answer
When you're writing Python code, it can generate quite a bit of overhead compared to other languages like JavaScript. Each line of Python you write involves the translation into many lines of lower-level code, which can consume more resources—and hence battery—than you might expect. A solid read is the study on energy efficiency across programming languages if you're interested.
Exactly! I thought Python was more efficient too. Seems like it really isn't compared to JS. Is there any way to mitigate this?
But isn't OP just talking about writing code? They're not executing anything yet, right?