From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e61c8636ef35379d X-Google-Attributes: gid103376,public From: Marin David Condic Subject: Re: Ada Streams usage (was Escape Sequences in Strings) Date: 2000/11/16 Message-ID: <3A14108E.CCB398A1@acm.org>#1/1 X-Deja-AN: 694385607 Content-Transfer-Encoding: 7bit References: <3A17B0E2@MailAndNews.com> <3A129A89.1B69E2FE@acm.org> <3A13D59E.63A6F92@earthlink.net> <3A13F487.59859C0F@acm.org> <8v11gb$hln$1@nnrp1.deja.com> X-Accept-Language: en X-Server-Date: 16 Nov 2000 16:51:17 GMT Content-Type: text/plain; charset=us-ascii Organization: Quadrus Corporation Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-11-16T16:51:17+00:00 List-Id: Ted Dennison wrote: > We are using streams for subsystem checkpointing in a hard real time > system. Its actually working quite well. But I did have to write my own > stream types to get it to work the way I needed it to. > Well, part of my objection to streams is the overhead of the data motion and the way it degenerates to a (potentially) large number of small procedure calls. (It wouldn't be so bad if the compiler could figure out when to generate a really fast block-move instruction instead of a bazillion procedure calls. But I suppose there may be language issues - or maybe just that it is really hard to do.) If you find a way to "roll your own" that eliminates or minimizes this, then it can still work quite well. I guess some of it depends on how hard is "hard". Its at least a deterministic amount of overhead if the message sizes don't vary. (Dynamic things like Unbounded_String, etc. might pose problems in this respect.) But if you are running a heavily loaded processor, the overhead is unnecessary work that ought to be eliminated so you can use it for something more important. Maybe my usage of the word is not entirely accurate. "Hard-real-time" usually means that failure to meet deadlines constitutes failure of the system. If your processor does a gazillion-instructions-per-second and you're only using 1% of your CPU, it can still be a "hard-real-time" system. I suppose I was thinking more along the lines of "difficult" real time systems. :-) > > Streams are quite useful any time you need to mainupulate large amounts > of unstructured data entirely within Ada. But if you need low-level > control over what is going on you are probably going to end up having to > write your own streams and stream attribute routines. That can be a lot > of work compared to some of the old-fashioned alternatives. Plus if you > are rewriting both ends, often there's no benifit to using streams over > just making your own custom object with read and write methods. Yeah. I understand. In most cases, I'd like to just use the standard Ada streams because it just automagically works for you. You do some fairly small amount of work at the base level and it just off and does it for everything you build up on it. Very elegant. Very tidy. Extremely clever. But when you've got to overcome the representation issues and/or eliminate the overhead by doing your own Read and Write routines, you end up putting so much extra work into it that you might just as well pitch streams and handle all the bytes yourself. MDC -- ====================================================================== Marin David Condic - Quadrus Corporation - http://www.quadruscorp.com/ Send Replies To: m c o n d i c @ q u a d r u s c o r p . c o m Visit my web site at: http://www.mcondic.com/ "Giving money and power to Government is like giving whiskey and car keys to teenage boys." -- P. J. O'Rourke ======================================================================