How to increase performance on PythonScript macro
-
Is there a way to increase macro performance of PythonScript macros? Would turning off screen updates as the macro executes help in this regard?
I have a daily task of editing a MySQL script file that is generated from a PHPMyAdmin export. The file is 120+ MB / 2.5+ million lines in size.
I have created a PythonScript macro to do the editing, but the execution takes quite some time to complete. I was thinking that performance might improve if the editor did not have to ‘play’ out the instructions on screen.
Another thought I had was would it be faster to run the script in a Python environment and just pass the filename in as a parameter.
Any suggestions would be greatly appreciated.
-
Would turning off screen updates as the macro executes help in this regard?
Very likely. Not sure if that is possible with the PythonScript plugin. Since the script runs as a separate thread then the screen has a chance to update.
Another thought I had was would it be faster to run the script in a Python environment and just pass the filename in as a parameter.
Most definitely would be faster. By how much? Not sure. But it would likely require you to rewrite the script from scratch since you wouldn’t have any type of access to Notepad++ editing commands (e.g. home, cut, copy, etc).
An alternative option would be to try out the LuaScript plugin (which is a plugin I wrote). It has a very similar interface like PythonScript and Lua is known for being a very fast scripting language. The script doesn’t run in a background thread so the screen wouldn’t update (although that means the entire Notepad++ application would appear to lock up until the script is complete).
Depending if the macro isn’t too huge I’d be willing to help you port it to LuaScript. I’d be very interesting to see performance results between the two ;)