comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Q: Line_IO
Date: Mon, 31 Aug 2009 18:52:31 +0200
Date: 2009-08-31T18:52:31+02:00	[thread overview]
Message-ID: <4a9bffcf$0$32667$9b4e6d93@newsspool2.arcor-online.net> (raw)
In-Reply-To: <41445103-0faf-4cb3-be93-99cb1d3c0080@z4g2000prh.googlegroups.com>

Anh Vo schrieb:

> I am curious how close when compared to GNAT.IO.Put_Line and
> GNAT.IO.Get_Line. If it is close enough, I would say it is the best of
> both worlds, speed and portability.

For reading, I don't know how to compare GNAT.IO.Get_Line.
This Get_Line seems to ignore the end of input.
AFAICS, it is implemented using C's getchar(), non-macro-versions
IIUC. Never compares the result of imported get_char <- getchar()
against C's EOF.

GNAT.IO.Put_Line seem to be slow.
It, too, ends up calling C's putchar().
In fact, it appears to be running many times more slowly than
Text_IO.Put_Line.

A few statistical results, sampled on one GNU/Linux machine.

$ gnatmake -g -O2 -gnatwa -gnatn test_line_io.adb

$ ./test_line_io < {250MB text file} > {some output file}


With Line_IO.Print and

-  Line_IO.Getline: ~3 seconds.
-  Text_IO.Get_Line: ~7.5 seconds.

With Ada.Text_IO.Put_Line and

-  Line_IO.Getline: ~21 seconds
-  Text_IO.Get_Line: ~27 seconds



  reply	other threads:[~2009-08-31 16:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4a9b045a$0$31875$9b4e6d93@newsspool3.arcor-online.net>
2009-08-31  8:28 ` Q: Line_IO Martin
2009-08-31 10:05   ` Georg Bauhaus
2009-08-31 15:33     ` Anh Vo
2009-08-31 16:52       ` Georg Bauhaus [this message]
2009-08-31 18:39 ` Dmitry A. Kazakov
2009-08-31 22:51   ` Robert A Duff
2009-09-01  0:35     ` Georg Bauhaus
2009-08-31 23:56   ` Georg Bauhaus
2009-09-01  0:19     ` Georg Bauhaus
2009-09-01  1:08       ` Robert A Duff
2009-09-01  7:02     ` Ludovic Brenta
2009-09-01  9:55       ` Georg Bauhaus
2009-09-01 12:03       ` jonathan
     [not found]       ` <4a9e2c86$0$30235$9b4e6d93@newsspool1.arcor-online.net>
2009-09-02  8:47         ` Georg Bauhaus
2009-09-05 20:30       ` Georg Bauhaus
replies disabled

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