comp.lang.ada
 help / color / mirror / Atom feed
* Wide Finder in Ada?
@ 2007-11-12  1:37 braver
  2007-11-12  7:57 ` Martin Krischik
  0 siblings, 1 reply; 5+ messages in thread
From: braver @ 2007-11-12  1:37 UTC (permalink / raw)


Tim Bray has a fantastic parallel programming challenge, Wide Finder,
running at full speed:

http://www.tbray.org/ongoing/When/200x/2007/10/30/WF-Results

It originated by trying parallel Erlang live up to regular Ruby.  Now
the top contenders are JoCaml -- parallel OCaml, Python, and there're
many implementations in Erlang, Haskell, and even things like PHP and /
bin/sh.  (This is the first place where I've heard "parallel gawk".)

Given the target box is Sun with 8 cores, Ada would shine there is my
guess.  Perhaps some pro here could beat JoCaml?

Cheers,
Alexy




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

* Re: Wide Finder in Ada?
  2007-11-12  1:37 Wide Finder in Ada? braver
@ 2007-11-12  7:57 ` Martin Krischik
  2007-11-12  9:55   ` braver
  2007-11-12 10:54   ` Georg Bauhaus
  0 siblings, 2 replies; 5+ messages in thread
From: Martin Krischik @ 2007-11-12  7:57 UTC (permalink / raw)


braver schrieb:
> Tim Bray has a fantastic parallel programming challenge, Wide Finder,
> running at full speed:
> 
> http://www.tbray.org/ongoing/When/200x/2007/10/30/WF-Results
> 
> It originated by trying parallel Erlang live up to regular Ruby.  Now
> the top contenders are JoCaml -- parallel OCaml, Python, and there're
> many implementations in Erlang, Haskell, and even things like PHP and /
> bin/sh.  (This is the first place where I've heard "parallel gawk".)
> 
> Given the target box is Sun with 8 cores, Ada would shine there is my
> guess.  Perhaps some pro here could beat JoCaml?

First here is the original Ruby code:

http://www.tbray.org/ongoing/When/200x/2007/09/20/Wide-Finder

So we know what to implement. Basicly:

1 Read File
1.1 Search for %r{GET /ongoing/When/\d\d\dx/(\d\d\d\d/\d\d/\d\d/[^ .]+) }
1.2 Count hits on found string using a map
2 Output result
2.1 sort map
2.2 output top 10

First improvement would be the use of Splitbool instead of regular
expressions. And then reading and counting could be decoupled. Some
implementation decouple reading the file and spitting into lines.

First things First: Any Splitbool specialist which can turn the Ruby
regex into splitbool?


Martin

-- 
mailto://krischik@users.sourceforge.net
Ada programming at: http://ada.krischik.com



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

* Re: Wide Finder in Ada?
  2007-11-12  7:57 ` Martin Krischik
@ 2007-11-12  9:55   ` braver
  2007-11-12 19:11     ` Martin Krischik
  2007-11-12 10:54   ` Georg Bauhaus
  1 sibling, 1 reply; 5+ messages in thread
From: braver @ 2007-11-12  9:55 UTC (permalink / raw)


On Nov 12, 10:57 am, Martin Krischik <krisc...@users.sourceforge.net>
wrote:
> First things First: Any Splitbool specialist which can turn the Ruby
> regex into splitbool?

The best solutions there went from regexes to custom parsers/field
extractors.  I wonder whether your excellent SAR is applicable, or
Dmitry Kazakov's SNOBOL matching?  Here's what top Python things look
like:

http://effbot.org/zone/wide-finder.htm

They use a Python toolkit replacing regexen, which is faster:

http://www.egenix.com/products/python/mxBase/mxTextTools/

Apparently regexen are not needed and something custom/simpler will
do, like splitting lines in Ada -- what's the fastest way to do that?

Cheers,
Alexy




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

* Re: Wide Finder in Ada?
  2007-11-12  7:57 ` Martin Krischik
  2007-11-12  9:55   ` braver
@ 2007-11-12 10:54   ` Georg Bauhaus
  1 sibling, 0 replies; 5+ messages in thread
From: Georg Bauhaus @ 2007-11-12 10:54 UTC (permalink / raw)



On Mon, 2007-11-12 at 08:57 +0100, Martin Krischik wrote:

> 1.1 Search for %r{GET /ongoing/When/\d\d\dx/(\d\d\d\d/\d\d/\d\d/[^ .]+) }

> 
> First improvement would be the use of Splitbool instead of regular
> expressions.

Do you mean SPITBOL? In this case, here is a simple and quick way to
to the pattern extraction (the ' 'sentinel  at the end of each
line might not be necessary or worked around or it doesn't
matter if it can be set by some Input).

        digit = any('0123456789')
        D2 = digit digit
        D3 = digit D2
        D4 = digit D3

* results table
        counts = table()

* read lines, find pages, and record hits

L       line = input                            :f(done)
        line = line ' '
        line ? 'GET ' fence '/ongoing/When/' D3 'x/'
.               (D4 '/' D2 '/' D2 '/' break(' .')) . word
.                                               :f(L)
        counts[word] = counts[word] + 1         :(L)
done





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

* Re: Wide Finder in Ada?
  2007-11-12  9:55   ` braver
@ 2007-11-12 19:11     ` Martin Krischik
  0 siblings, 0 replies; 5+ messages in thread
From: Martin Krischik @ 2007-11-12 19:11 UTC (permalink / raw)


braver wrote:

> On Nov 12, 10:57 am, Martin Krischik <krisc...@users.sourceforge.net>
> wrote:

>> First things First: Any Splitbool specialist which can turn the Ruby
>> regex into splitbool?
> 
> The best solutions there went from regexes to custom parsers/field
> extractors.  I wonder whether your excellent SAR is applicable, or

Yes SAR could do the trick (actually the low level backend) - but AdaCL
depends on to many libraries to be submitted to a competition.

Martin

-- 
mailto://krischik@users.sourceforge.net
Ada programming at: http://ada.krischik.com



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

end of thread, other threads:[~2007-11-12 19:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-12  1:37 Wide Finder in Ada? braver
2007-11-12  7:57 ` Martin Krischik
2007-11-12  9:55   ` braver
2007-11-12 19:11     ` Martin Krischik
2007-11-12 10:54   ` Georg Bauhaus

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