ElEscalador
Posts: 619
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA
Contact: Website

How the Heck does my RPI3 Complete a Program 1200% Faster than my HP Probook??

Sat Aug 04, 2018 9:01 pm

I wrote my first navigation/collision avoidance program in c++...I wrote it on my windows laptop (1.6ghz, 8gb ram, 64 bit, windows 10) in visual studio - intended to end up in my robot. Since it was my own code (based on A Star algorithm) I knew it wouldn't be the most efficient, but it was taking 1-5 minutes to find a path when run from visual studio. I was afraid this would translate to 10-30 minutes on the rpi in my robot, so I uploaded the exact same program to a PI3, added a stopwatch to each, and ran it with the exact same inputs (start, target, simulated obstacles). Much to my surprise, the windows machine was still running and the PI3 found a path almost instantly - way less than a second. I tried a few times and each time, both machines return the same waypoint list, but the pi is faaaaast and the windows machine is like snail-mail (typical - windows 120 seconds, RPI <1 second). I presume this has something to do with visual studio and not the hardware, but I am curious....who knows why this is happening? Is there anything I can do to make the windows machine run the program fast like that? I don't have a bunch of other stuff running except Chrome (that I know of...I have recently run Malwarebytes). This can't all be because of bloatware...can it? The machine runs fine for all my other purposes.
My Autonomous Robot Project and a few of my other projects below.

https://lloydbrombach.wordpress.com/

User avatar
mooblie
Posts: 84
Joined: Fri Oct 14, 2016 2:07 pm
Location: The Scottish Highlands

Re: How the Heck does my RPI3 Complete a Program 1200% Faster than my HP Probook??

Sat Aug 04, 2018 9:49 pm

"Overheads."

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20748
Joined: Sat Jul 30, 2011 7:41 pm

Re: How the Heck does my RPI3 Complete a Program 1200% Faster than my HP Probook??

Sun Aug 05, 2018 7:40 am

Sounds like the windows build might be a debug build.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

mikerr
Posts: 2729
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: How the Heck does my RPI3 Complete a Program 1200% Faster than my HP Probook??

Sun Aug 05, 2018 9:48 am

Probably debug build, there's a huge amount of expensive runtime checks enabled by default
such as out-of-bounds array indexing and memory overrun detection

https://randomascii.wordpress.com/2011/ ... slowdowns/

(although for some code it can be 100x slowdown.. debug is meant to debug, not for general use)

Try release build, also
Project Settings, then go to C++/Preprocessor, add _SECURE_SCL=0
Android app - Raspi Card Imager - download and image SD cards - No PC required !

ElEscalador
Posts: 619
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA
Contact: Website

Re: How the Heck does my RPI3 Complete a Program 1200% Faster than my HP Probook??

Mon Aug 06, 2018 12:05 pm

I had tried compiling as release and running the exe to no improvement, but whatever "_SECURE_SCL=0" does fixed it right up. I haven't compared run times again to the Pi, but now when I'm testing code on the windows /VS machine it's executing in a few seconds compared to 2-3 minutes. Thanks!
My Autonomous Robot Project and a few of my other projects below.

https://lloydbrombach.wordpress.com/

User avatar
ab1jx
Posts: 677
Joined: Thu Sep 26, 2013 1:54 pm
Location: Heath, MA USA
Contact: Website

Re: How the Heck does my RPI3 Complete a Program 1200% Faster than my HP Probook??

Fri Aug 24, 2018 2:27 am

Superior operating system. :) But 1.8 GHz and how many cores? Is 8 GB enough for Windows 10? I've never seen it. Sounds like you loaded modern bloatware onto an old machine. Is it swapping out? I have one friend that liked to do that, just had to have the latest software even if the machine couldn't handle it.

I haven't seen visual studio in 20 years but Borland stuff was a lot better then. Microsoft doesn't do a lot that's unique and wonderful. And I made a living cleaning up after their stuff. Retired 10 years ago, all Linux and OpenBSD now, I barely remember how to run it.

Return to “C/C++”