comp.lang.ada
 help / color / mirror / Atom feed
* Question on speed of set operations
@ 2019-03-29 22:39 reinert
  2019-03-29 23:11 ` Simon Wright
  0 siblings, 1 reply; 4+ messages in thread
From: reinert @ 2019-03-29 22:39 UTC (permalink / raw)


Dear all,

I try to make an "Include" procedure similar to

procedure Include(Container: in out Set; New_Item: in Element_Type);

(under Containers.Ordered_sets) and where one includes 
(eventually replaces) elements in a set instead of including 
one element at a time. The intention is to make the user code 
clean/readable and efficient.

So what is the best alternative among the following tree procedures
for the above purpose (in terms of *speed*):

procedure Include(Container: in out Set; New_Items: in Set) is
begin
   for e of New_Items loop
       Container.Include(e);
   end loop;
end include_set;

procedure Include(Container: in out Set; New_Items: in Set) is
begin
   Container.Difference(New_Items);
   Container.Union(New_Items);
end include_set;

procedure Include(Container: in out Set; New_Items: in Set) is
begin
   Container := New_Items or Container
end include_set; 

Could there be other/better alternatives? And/or am I trying
to reinvent the wheel?

reinert


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

end of thread, other threads:[~2019-04-02  6:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-29 22:39 Question on speed of set operations reinert
2019-03-29 23:11 ` Simon Wright
2019-04-01 21:43   ` Randy Brukardt
2019-04-02  6:03     ` reinert

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