Runtime Visual Studio

Hey everyone,
i just made a basic program to calculate a the product of a 500x500(don't ask me ask my professor) matrix with itself and everything is ok the only problem is Visual Studio takes like 10 times longer than g++ to run it. I raised the Stack Reserve size to 8 mb but this has to do with the processor doesn't it, cuz nothing changed? If yes is there any way I can give more resources to visual studio?
Are you building it in "Release" or "Debug"?
Sorry I don't know what "Realease" is. I use VS Community -> console application, "Build solution" and then "Start without debugging".
"Change the build configuration" in page https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-set-debug-and-release-configurations?view=vs-2019

Basically, I suspect you're building your code deliberately slowly, with optimisation turned off and extra symbols in it. I suspect you're building a slow version to make it easier to debug.

You have to only change the build configuration, you can find how to do it in youtube.
https://dailycrossword.onl/usa-today/
https://mailsafe.onl/protonmail/
Last edited on
Basically, I suspect you're building your code deliberately slowly, with optimisation turned off and extra symbols in it. I suspect you're building a slow version to make it easier to debug.

Nope, at least not deliberately. I'm using O2 optimisation and no extra symbols, at least not that I know of. Nevertheless changing it from "Debug" to "Release" configuration lowered the runtime significantly so thanks for the replies :D
transpose the matrix when you create it into a second copy matrix and then multiply them by going across the columns of each row instead. This simple change may net you a significant speedup for both compilers. Jumping rows when a row is this wide will trigger extra page faults which slow you down a bit.
Last edited on
I used 2 read-only(const) iterators to go through the vector simultaneously. Isn't this faster than creating copies?
I used 2 read-only(const) iterators to go through the vector simultaneously. Isn't this faster than creating copies?
Not if there are page faults involved. It takes a million times longer to access data on the disk compared to RAM. When you access a large array row-by-row, you're hitting a different page for each row. That can quickly cause page faults for every access which slows the program to a crawl. Creating the transpose like Jonnin suggests will speed up the process.

On the other hand, a 500x500 matrix only takes about 2MB of space - a trivial amount on today's computers. So I don't know how much it will help.
Topic archived. No new replies allowed.