comp.lang.ada
 help / color / mirror / Atom feed
* An optimizing compiler idea
@ 2014-07-04 16:55 Victor Porton
  2014-07-04 22:26 ` anon
  0 siblings, 1 reply; 2+ messages in thread
From: Victor Porton @ 2014-07-04 16:55 UTC (permalink / raw)


In this post I ask whether my idea is not new and already implemented. And 
also I suggest to implement it in Ada compilers.

I propose not to store an array bound if it is constant (1 in the example 
below).

This can be used to create container types which could be more efficient 
than plain arrays.

Below is a toy container type giving an example of my idea:

package Test is

   type Test_Array_Type is array(Integer range <>) of Float;
   
   type Test_Record(Size: Integer) is
      record
         Test_Array: Test_Array_Type(1..Size);
      end record;

end;

In this example we can store only one (upper) index of an array. Thus it 
could be faster and more memory efficient than plain array with a range of 
two indexes.

-- 
Victor Porton - http://portonvictor.org


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: An optimizing compiler idea
  2014-07-04 16:55 An optimizing compiler idea Victor Porton
@ 2014-07-04 22:26 ` anon
  0 siblings, 0 replies; 2+ messages in thread
From: anon @ 2014-07-04 22:26 UTC (permalink / raw)


This concept has been used around since the begining Ada 83.  


In <lp6m9q$lu0$1@speranza.aioe.org>, Victor Porton <porton@narod.ru> writes:
>In this post I ask whether my idea is not new and already implemented. And 
>also I suggest to implement it in Ada compilers.
>
>I propose not to store an array bound if it is constant (1 in the example 
>below).
>
>This can be used to create container types which could be more efficient 
>than plain arrays.
>
>Below is a toy container type giving an example of my idea:
>
>package Test is
>
>   type Test_Array_Type is array(Integer range <>) of Float;
>   
>   type Test_Record(Size: Integer) is
>      record
>         Test_Array: Test_Array_Type(1..Size);
>      end record;
>
>end;
>
>In this example we can store only one (upper) index of an array. Thus it 
>could be faster and more memory efficient than plain array with a range of 
>two indexes.
>
>-- 
>Victor Porton - http://portonvictor.org



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-04 22:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-04 16:55 An optimizing compiler idea Victor Porton
2014-07-04 22:26 ` anon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox