Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What about Ada? #15

Closed
vporton opened this issue Jul 4, 2014 · 3 comments
Closed

What about Ada? #15

vporton opened this issue Jul 4, 2014 · 3 comments

Comments

@vporton
Copy link

vporton commented Jul 4, 2014

What about Ada?

I suspect it is a little faster than C++, mainly thanks to explicit parameter modes (what may allow to use registers for in-out parameters) instead of how C++ pass pointers for the same deal (and the compiler cannot be sure that the pointer is not null and that registers can be used instead).

However Ada has the drawback of storing two integers with each array (to maintain its range). In principle, this can be get rid of with an optimizing compiler which would not store the lowest index of an array, provided that this index can be restored from a record discriminant. This can be used for creating optimizing collections, which are faster than plain arrays. (I don't know whether this my optimization idea for Ada is already implemented.)

@vporton
Copy link
Author

vporton commented Jul 4, 2014

Well, I forget that C++ has references not only pointers. Can C++ reference arguments be passed through registers? If so, C++ probably has the same performance as Ada.

See also:

https://groups.google.com/forum/#!topic/comp.lang.ada/eFNW9PyWdPM

@vporton
Copy link
Author

vporton commented Jul 5, 2014

Someone Guillaume Foliard has written the Ada code. And yes, this code is much faster than C++. Please add the Ada code to your benchmark. (I could do it with Git myself, but I am busy with other, more important projects.)

https://groups.google.com/forum/#!topic/comp.lang.ada/Qcaio8hrAyo

Ada:
Elapsed time is = 1.966112682

C++:
Elapsed time is   = 3.12033

@vporton vporton closed this as completed Jul 5, 2014
@vporton vporton reopened this Jul 5, 2014
@jesusfv
Copy link
Owner

jesusfv commented Jul 18, 2014

I do not think anyone in economics uses ADA. While it may be an
interesting for people in the industry, it is a bit less relevant for
the goal of our paper

Thanks for the suggestion

On 7/4/14, 12:40 PM, Victor Porton wrote:

What about Ada?

I suspect it is a little faster than C++, mainly thanks to explicit
parameter modes (what may allow to use registers for in-out
parameters) instead of how C++ pass pointers for the same deal (and
the compiler cannot be sure that the pointer is not null and that
registers can be used instead).

However Ada has the drawback of storing two integers with each array
(to maintain its range). In principle, this can be get rid of with an
optimizing compiler which would not store the lowest index of an
array, provided that this index can be restored from a record
discriminant. This can be used for creating optimizing collections,
which are faster than plain arrays. (I don't know whether this my
optimization idea for Ada is already implemented.)


Reply to this email directly or view it on GitHub
#15.

Jesús Fernández-Villaverde
Economics-University of Pennsylvania
www.econ.upenn.edu/~jesusfv

君臣上下貴賤皆從法,此謂為大治

@jesusfv jesusfv closed this as completed Jul 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants