The performance of WordPress does not depend on the number of posts. It depends on the server performance (how fast can PHP scripts be executed). And the performance of the MySQL Server.
The server performance is normally no problem if you got enough memory. The bottleneck is in most cases the MySQL server and the connection to it. Sometimes a misconfigured MySQL server can slow down your database queries. MySQL is made to handle very large databases, it makes no difference if there are 15 or 15 million posts. wordpress.com is made with WordPress and there are definitivly a lot of post to handle.
But this is all out of scope of this page, it has nothing to do with WordPress.
WordPress itself cann be slowed down by bad written plugins and themes. Such who make a lot of (senseless) database queries. There is no other way then uninstall problematic plugins and/or themes and use better ones.
I will write some script to import all the products
It depends on which language you use for your script. PHP is not the first choice for such a job. A MySQL script would be the better choice and can do the job much faster.