Is database performance optimization independent of the size of a database or a table? If by rewriting an operation or a piece of code the performance has increased by 30% in a program reading and writing to a table with 100,000 records, does that optimization remains same if the table grows and would have 10,000,000 records i.e. still 30%? 

Given that the hardware has not been modified.
There is no definite answer. It really depends on the data and the change you have performed.

For instance, if you created an index that helped in the 100,000 records table, in many cases it will help with the 10,000,000 records table.

However, if, let's say, you had a cursor and you've rewritten it to a set based solution, it will be good enough for the 100,000 records table, but not good in the 10,000,000 records table because there is no supporting index for the query.

The best thing to do is to monitor the system as it grows and see if queries keep running fast or degrade, and fix accordingly.