6 Replies - 1179 Views - Last Post: 27 March 2014 - 07:31 AM

#1 R2B Boondocks  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 12
  • View blog
  • Posts: 195
  • Joined: 19-September 12

C compile time vs Ada compile time

Posted 25 March 2014 - 12:20 PM

I was wondering why Ada takes a lot longer to compile (translate)than C source code? Also what was the phase of the Ada translation that takes the longest?

Is it because of Ada's dynamic memory management being high level and type-safe? (an answer I found, unsure on validity)

"translation in ADA is time taking because Ada's dynamic memory management is high-level and type-safe. Ada does not have generic or untyped pointers; nor does it implicitly declare any pointer type. Instead, all dynamic memory allocation and deallocation must take place through explicitly declared access types."

Thanks for any input!

*EDIT*

Sorry if this isn't the right location for the topic I wasn't sure where to place it

This post has been edited by R2B Boondocks: 25 March 2014 - 03:30 PM


Is This A Good Question/Topic? 0
  • +

Replies To: C compile time vs Ada compile time

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3553
  • View blog
  • Posts: 11,017
  • Joined: 05-May 12

Re: C compile time vs Ada compile time

Posted 25 March 2014 - 04:57 PM

I don't really know since I've only toyed with Ada during a computer fair for perhaps about 10 minutes, but the first question I would ask is if this is an apples to apples comparison:
- Same type of program is being compiled.
- Both the C and Ada compiler were written by the same "generation" of compiler authors -- that is all the tricks and optimizations that C compiler writers have learned over the years has also been applied to the Ada compiler.


Anyway, if I had to guess, this quote from Wikipedia would be the reason I would put my money on:

Quote

A large number of compile-time checks are supported to help avoid bugs that would not be detectable until run-time in some other languages or would require explicit checks to be added to the source code. For example, the syntax requires explicitly named closing of blocks to prevent errors due to mismatched end tokens. The adherence to strong typing allows detection of many common software errors (wrong parameters, range violations, invalid references, mismatched types, etc.) either during compile-time, or otherwise during run-time. As concurrency is part of the language specification, the compiler can in some cases detect potential deadlocks. Compilers also commonly check for misspelled identifiers, visibility of packages, redundant declarations, etc. and can provide warnings and useful suggestions on how to fix the error.


Moving this thread over to Software Development rather than C/C++...
Was This Post Helpful? 1
  • +
  • -

#3 R2B Boondocks  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 12
  • View blog
  • Posts: 195
  • Joined: 19-September 12

Re: C compile time vs Ada compile time

Posted 26 March 2014 - 05:13 AM

Thanks for your input Skydiver. I believe Ada was used in the DoD during its earliest years. Would that have anything to do with compile times? Perhaps it didn't have the optimizations the C compiler did when it came out?

Another thought is: In Java (Eclipse) the compiler is constantly checking for errors before actually being told to compile (during code generation). Does C have something like this?
Was This Post Helpful? 0
  • +
  • -

#4 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2102
  • View blog
  • Posts: 3,208
  • Joined: 21-June 11

Re: C compile time vs Ada compile time

Posted 26 March 2014 - 06:40 AM

View PostR2B Boondocks, on 26 March 2014 - 01:13 PM, said:

Perhaps it didn't have the optimizations the C compiler did when it came out?


Generally speaking optimizations lead to longer compile times, not shorter ones.
Was This Post Helpful? 0
  • +
  • -

#5 R2B Boondocks  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 12
  • View blog
  • Posts: 195
  • Joined: 19-September 12

Re: C compile time vs Ada compile time

Posted 26 March 2014 - 06:50 AM

View Postsepp2k, on 26 March 2014 - 01:40 PM, said:

View PostR2B Boondocks, on 26 March 2014 - 01:13 PM, said:

Perhaps it didn't have the optimizations the C compiler did when it came out?


Generally speaking optimizations lead to longer compile times, not shorter ones.


That's good to know. Thinking about it I suppose that makes sense. The optimizations allow greater detection of errors and would cause it to take longer to sift through all the checks.
Was This Post Helpful? 0
  • +
  • -

#6 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3553
  • View blog
  • Posts: 11,017
  • Joined: 05-May 12

Re: C compile time vs Ada compile time

Posted 26 March 2014 - 06:16 PM

View PostR2B Boondocks, on 26 March 2014 - 08:13 AM, said:

Another thought is: In Java (Eclipse) the compiler is constantly checking for errors before actually being told to compile (during code generation). Does C have something like this?

Visual Studio 2013 does this, as well as VS2008, and VS2012. VS2010 took it out because by the time the rest of VS2010 was ready to ship, Microsoft determined that the brand new engine they had developed was too buggy for public consumption. So for VS2010 you had to go to a 3rd party company to get that effect.

View Postsepp2k, on 26 March 2014 - 09:40 AM, said:

View PostR2B Boondocks, on 26 March 2014 - 01:13 PM, said:

Perhaps it didn't have the optimizations the C compiler did when it came out?


Generally speaking optimizations lead to longer compile times, not shorter ones.

By optimizations, I was not talking about generated code optimizations. I was talking about tricks played by the compiler to speed up compilation like pre-compiled headers, memory mapped files, better symbol table implementations than you would have gotten using lex and yacc, etc.

But yes, I do agree it will take more time to optimize generated code.
Was This Post Helpful? 1
  • +
  • -

#7 R2B Boondocks  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 12
  • View blog
  • Posts: 195
  • Joined: 19-September 12

Re: C compile time vs Ada compile time

Posted 27 March 2014 - 07:31 AM

Good information...thanks guys :D
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1