I have several WordPress running plugins on my site and as per suggestions of wordpress performance optimizations I am planning to do the optimizations on plugins myself.
However, that will mean that I will have to modify existing plugins codes. Now, as WordPress plugins release frequent updates, the updates will wipe out my manual changes. How can I keep sync between these? That means, how can I get updated plugin and keep my manual changes as well?
Create a local repository in Git (or SVN) for the plugin, and each time an update happens:
But much better would it be to send your improvements to the plugin author, so she can use that in the main code. Keeping improvements secret is not the spirit of Open Source.
It depends on what kind of mods you are going to perform. If plugin uses filters and actions, you can hook them, or deregister them and register your own modified functions instead of them, from your custom plugin or theme’s functions.php.
You can read more about hooks and filters in codex.
There isn’t really a practical way to go about this that will ensure you can update plugins that you have modified and still guarantee your changes will work, unless you inspect the newly released code prior to merging your changes.
So that means every time a plugin update is available, you would need to check that the modifications you have made are still applicable to the newly updated code base because in some instances a plugin author may change their Class/Method/Function structure so as it represents nothing like the changes you have made.
In cases where your modifications do not work in the context of the newly released version of said plugin then you will need to re-adjust accordingly.
You need to keep a local repository/copy/version of your changes and check those against future updates.
This all requires some effort on your part, attention to detail, that would otherwise be better focused toward trying to convince the plugin authors in question to make the same changes that you have made for improved performance.