-->
Page 1 of 1

Why is the sketch recompiled even if it is unchanged?

PostPosted: Sun Apr 26, 2020 12:27 pm
by lotus49
I find it hard to believe that this isn't a common question but the only similar question I could find was asked years ago and wasn't answered satisfactorily.

When I click Upload, my sketch is compiled and uploaded. This makes sense if the sketch has been changed since it was last compiled but why is the sketch recompiled when none of the code has changed since the last compilation? My programmes are all small so compilation is fairly quick but I don't understand why it happens at all.

Re: Why is the sketch recompiled even if it is unchanged?

PostPosted: Sun Apr 26, 2020 12:46 pm
by Bonzo
I would guess as you are not saving a compiled version anywhere so to upload it needs to be recompiled. All the libraries etc. added to your code.

Re: Why is the sketch recompiled even if it is unchanged?

PostPosted: Mon Apr 27, 2020 10:28 am
by btidey
The first compile and link in a session takes longer but the results are cached so that libraries etc are not recompiled on subsequent builds which are much faster. I don't know why the overall compile / link is not skipped if nothing whatsoever has changed but in practice if one is just changing sketch code then the build is pretty fast.

Re: Why is the sketch recompiled even if it is unchanged?

PostPosted: Wed Apr 29, 2020 12:17 pm
by lotus49
Thank you for the replies.

I had noticed that it typically doesn't take as long the second time but it still takes longer than not doing it at all. It's only a mild annoyance but I've never seen this in an IDE before.