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,9c86eb13dd395066 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: CRC in Ada? Date: 1997/03/13 Message-ID: #1/1 X-Deja-AN: 225327759 References: <1997Mar2.220652@nova.wright.edu> <1997Mar5.131846.1@eisner> <5fmo1k$adm@mulga.cs.mu.OZ.AU> <1997Mar6.114441.1@eisner> <1997Mar7.090814.1@eisner> <33206340.2616@bix.com> <5g157e$pqf@ratatosk.uio.no> <5g1qtg$4ad$1@A-abe.resnet.ucsb.edu> <5g4k31$g54$1@A-abe.resnet.ucsb.edu> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-03-13T00:00:00+00:00 List-Id: Jon says <> Sure, this is a possible optimization, but not such a simple one. For one thing, we deliberately introduce another level of abstraction in GNAT, namely the system.stream_attributes package in s-stratt.ads. This is provided so that it is possible to substitute alternative semantics for stream handling for primitive elements, and for example GLADE takes advantage of this to substitute XDR (target independent) semantics. Now it would be easy enough to at least provide an extra entry point for string processing in system.stream_attributes for the special case of string (and maybe wide_string), so that the front end could still do the optimization, but this would not generalize to all arrays, and in any case, the generalization to all arrays is not always possible, it can be derailed by alignment considerations, or by packing, or by the specification of component size. Note that the additional layer here does not introduce extra call overhead since it can be inlined, but it does make it virtually impossible using the current interface, to specialize the case of stream attributes on strings. As I say, the interface can easily be change. Handling stream_io more efficiently on strings has been down on our list of possible optimziations for a long time, but it's not particularly high priority -- so far it has not been a significant performance issue for any of our customers! Robert Dewar Ada Core Technologies P.S. I strongly encourage people to do profiling on their applications. Nothing like finding out what *actually* takes the time, as opposed to guessing at what might be critical optimizations! Much the most convincing kind of input here is profiles from a real application, not one construted to make the point, that show that x% of time is spent in string stream attributes, where x is high enougj to worry about.