Pages: [1] 2 3   Go Down
Author Topic: Compile Speed - testing & feedback needed!  (Read 8904 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
God Member
*****
Karma: 26
Posts: 621
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I wrote code that cuts several seconds off the normal compile/upload time.  Here's a little video I made yesterday to demonstrate.



This works much like Make, Ant and other build systems, by reusing the previously compiled files from the last time.  I actually wrote this almost a year ago, but it was considered too risky to use in Arduino until more people have tested it and confirmed it really works.  So the code sat unused and forgotten for almost a year!

Well, now that Arduino 1.0 is here (or will be in a few days), I'm hoping to revive this and hopefully get enough people to test so it can someday become part of Arduino.

Here's the page with the installer that adds it. 

http://www.pjrc.com/teensy/td_download.html

If you're using a non-Teensy board, you'll also have to edit boards.txt.  The line that enables it looks like this:

Code:
uno.build.dependency=true

You should notice a substantial speedup compiling the same sketch.  Hopefully when you switch sketches, board types, or have multiple windows open at once... stale code from one should not be used again in another.

If you give this a try, working or not, please take a moment to comment on issue 638.

http://code.google.com/p/arduino/issues/detail?id=638

This feature has sat unused since November 2010, and it may never get much use beyond Teensy boards without your help!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks great, I will test is for sure smiley-wink
thanx
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I didn't want to add just another "Me too" to your ticket, but using Arduino-0022, Arduino 1.0 Beta 3, and Arduino 1.0 Beta 4: I've installed teesyduino into each of those directories and, while I do get the teensy additions showing in the IDE, modifying boards.txt (and restarting) does not change the compliation. It still recompiles all files.
Logged

0
Offline Offline
God Member
*****
Karma: 26
Posts: 621
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Without more info, I can't know why it's recompiling everything.

If you're willing to try more, here's a few suggestions.

1: Can you post the verbose messages.  On 1.0-beta4, enable in the preferences.  On 0022, hold the shift key.  The speedup only applies to "upload", not "verify".

2: Can you post your boards.txt file?  There's several boards in the file, so make sure you're added this line for the board you're using.

3: Can you tell me which operating system and which board you're using?  I have most combinations here.  While it should work on all, I've only tested a small set of all the possible permutations (eg, only Uno and Teensy 2.0 on Windows, etc)

4: Could you reinstall Teensyduino 0.98?  If you have 0.97 or earlier, there was a bug parsing the dependency files.  It turns out the Windows and Mac versions have extra white space which isn't present on the Linux version.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

1: Can you post the verbose messages.  On 1.0-beta4, enable in the preferences.  On 0022, hold the shift key.  The speedup only applies to "upload", not "verify".
Oh that would do it!  Yeah I was only doing the compile / shift compile. With upload you're right it works great!  Will post to your ticket with my results.
Logged

0
Offline Offline
God Member
*****
Karma: 26
Posts: 621
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Oppps, guess I could have mentioned it only speeds up "upload"  smiley-wink

I actually spent a lot of time editing that video down to only 2.5 minutes.  Maybe I cut too much?

Glad it's working.  Hopefully anyone else who tries it will see this and know to use Upload instead of Verify.
« Last Edit: September 19, 2011, 07:02:59 pm by Paul Stoffregen » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I thought the video was very professional actually! Arduino videos are synonymous for me with "Ummm hey guys, this ummm an arduino" with the video being taken by a cellphone camera shakily shooting a monitor you can't read. Your video a welcome surprise-- brief, to the point, informative, and clear.

One of my projects is around 60 files and this is so nice to be able to compile it much faster. If I can ever get git to clone to my machine, I'd love to add an option to skip the verify step of the avrdude upload and get my 30KB compile + upload down to 15s total!

Another important thing for others to note: When you hit "Save" in the Arduino IDE, it cleans the build directory and removes all the pre-compiled files. This also prevents this optimization from being used.
Logged

ottawa, canada
Offline Offline
God Member
*****
Karma: 6
Posts: 993
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So this would only speed up the part until the size of the module is displayed - right?
Logged

Bill Rowe
Olduino - An Arduino for the First of Us
www.olduino.wordpress.com

0
Offline Offline
God Member
*****
Karma: 26
Posts: 621
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yup, it only speeds up the compile part.

If you're using Teensy, the data transfer goes pretty fast, since it's full USB speed.  I recently discovered that Teensy can go even faster.  It turns out much of the time is wasted waiting for operating system scheduling.  I'm planning to overhaul the process to use overlapping async I/O to remove the dependency on operating system scheduling.  I like things to go fast!

The process for official Arduino boards isn't under my control.  In fact, with Teensyduino, I try very hard to make sure I don't accidentally alter anything about how non-Teensy boards work.  That's why you need to copy that line into boards.txt to enable this.
Logged

0
Offline Offline
God Member
*****
Karma: 26
Posts: 621
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

As a final followup, I prepared a patch and posted it to issue 638.

http://code.google.com/p/arduino/issues/detail?id=638

Due to the underwhelming response, I'm not planning to work further to contribute this feature to the larger Arduino community.  The source is there if anyone wants to use it, or continue to improve it and advocate its use.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I gave it a try___ and it worked out for me... Thank you very much, I was so tired of the long building times.
In my case, building time (without upload) was reduced from 15 sec to 5 sec, if I only make a few changes in code, e.g. adjust some timings.

Now I will get Optiboot to speed up the upload, and voila, i will get the max out of my development time...

Thanky.... smiley-wink


Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27352
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Paul,
Maybe with the release of Leonardo & ATMege324U4 with built in USB, this will come in handy as a tool.
I didn' really notice long compile times before, guess I am not writing long enough programs.

Robert
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
God Member
*****
Karma: 26
Posts: 621
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, the upload to Arduino is slow due to the limited serial speed.  It's hard to notice how long the compile takes, because the slow upload takes much longer.

I developed this compile speedup for Teensyduino, which uses the 32u4 chip (and has been Arduino compatible for nearly 2 years).  If you've never tried a Teensy, you'll probably be surprised how fast uploading code is.  With Teensy's fast data transfer speed, recompiling everything became most of the wait, but this change eliminates most of that wait too.

Here's a video I recently uploaded.  Check out the upload speed.  It's at approx 0:42 in the video.



Did you actually try this speedup?  How much speedup difference does it make on your computer?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27352
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have not tried  it.  However, I am putting together a Duemilanove type board with the ATMega32U4, and I'm thinking the Teensyduino code could be good on that.

I haven't decided what to do with the extra 6 pins yet; I have going to a jumper block to allow I2C or A4/A5 to connect to the header, and put some parts in support the PE2 & PE6 pins. That leaves PC6 & PC7 still unconnected.

I have assigned the connections to the headers to maintain compatibility, this makes the layout work ok, not sure if the assignments make sense or how much pins_arduino.c will need to be revised.


* ATMega324_layout.jpg (155.26 KB, 960x720 - viewed 49 times.)

* ATMega324_schem.jpg (51.59 KB, 960x720 - viewed 55 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 135
Posts: 6782
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How does the installer work?  Is it version independent, or only applicable to 0022?

I'm hoping that Arduino will eventually go to a make-based compilation, even if the default behavior is to recompile everything.
Logged

Pages: [1] 2 3   Go Up
Jump to: