comp.lang.ada
 help / color / mirror / Atom feed
From: Egil H H <ehh.public@gmail.com>
Subject: Re: Optimizing Ada
Date: Wed, 2 Oct 2013 00:01:29 -0700 (PDT)
Date: 2013-10-02T00:01:29-07:00	[thread overview]
Message-ID: <3925301c-22af-4d37-8ab0-28ded42d5252@googlegroups.com> (raw)
In-Reply-To: <8aca502c-bba8-4af5-9192-459c15fe048b@googlegroups.com>

On Wednesday, October 2, 2013 4:58:40 AM UTC+2, kennet...@gmail.com wrote:
> 
<snip>
>  The only real snags I've hit with Ada is trouble with finding documentation on the standard library.
> 

The Standard Library is defined in Annex A of the reference manual,
http://www.adaic.org/resources/add_content/standards/12rm/html/RM-A.html

Specifically, see section A.18.4 for a description of Maps:
http://www.adaic.org/resources/add_content/standards/12rm/html/RM-A-18-4.html

> 
> Ada Code : http://pastebin.com/vDbdXCYD (a quotation mark messed up highlighting near bottom)
> 


You could try to preallocate space in the Word_Map by calling
Word_Map.Reserve_Capacity(some_fairly_large_number);

Also, you're calling Update_Element even for new words. Depending on your dataset, that could potentially be a lot of unneccessary callbacks. Try this:

Word_Map.Insert(Key      => Word,
                New_Item => 1,      -- <----
                Position => Location,
                Inserted => Added);
if not Added then
   Word_Map.Update_Element(Position => Location,
                           Process   => Increment_By_One'Access);
end if;



Rust probably have a faster hash function (seems they use SipHash 2-4). Try to implement the same algorithm in Ada, see if that makes a difference.

  parent reply	other threads:[~2013-10-02  7:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-02  2:58 Optimizing Ada kennethesills
2013-10-02  3:47 ` Jeffrey Carter
2013-10-02  3:53   ` kennethesills
2013-10-02  4:13     ` Jeffrey Carter
2013-10-02  4:24       ` kennethesills
2013-10-02  8:11         ` Jacob Sparre Andersen
2013-10-02 10:32           ` Marius Amado-Alves
2013-10-02 14:24           ` kennethesills
2013-10-02 16:41         ` Jeffrey Carter
2013-10-02 18:58       ` John B. Matthews
2013-10-02  7:01 ` Egil H H [this message]
2013-10-02  7:16 ` Simon Wright
2013-10-02 14:43   ` kennethesills
2013-10-02 10:24 ` Marius Amado-Alves
2013-10-02 14:29   ` kennethesills
replies disabled

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