Ask a Question related to ASP.NET Web Services, Design and Development.

  1. #1

    Default Class v. Structure

    Is there any performance considerations for a web service returning a
    structure versus an instance of a class?
    Just Me Guest

  2. Similar Questions and Discussions

    1. Class::Struct - want to access structure within structure
      I want to access a structure within a structure. Below is what I had in mind. Please help. #!/perl/bin/perl use Class::Struct; struct Step...
    2. Hiding Abstrected Class Structure in WSDL
      I’m building a simple web service that has a few functions, each returning simple data classes, structured similar to this: public class...
    3. #25580 [WFx]: set_error_handler to a class/method resets class properties when error occurs
      ID: 25580 Updated by: sniper@php.net Reported By: paul dot liversidge at recycledpixels dot com Status: Wont...
    4. #25580 [Opn->WFx]: set_error_handler to a class/method resets class properties when error occurs
      ID: 25580 Updated by: sniper@php.net Reported By: paul dot liversidge at recycledpixels dot com -Status: Open...
    5. #25580 [NEW]: set_error_handler to a class/method resets class properties when error occurs
      From: paul dot liversidge at recycledpixels dot com Operating system: Windows XP PHP version: 4.3.2 PHP Bug Type: ...
  3. #2

    Default Re: Class v. Structure

    Hello Just,

    JM> Is there any performance considerations for a web service returning
    JM> a structure versus an instance of a class?

    Seems not, coz both of them need to be serialized

    ---
    WBR,
    Michael Nemtsev



    Michael Nemtsev Guest

  4. #3

    Default Re: Class v. Structure

    Methods do not get serialized so it would seem more straighforward,
    clearer, more inutitive, etc. in reading the code to use structures.
    I know in .Net, structures can have methods, but I've used them in the
    past strictly for grouping relate elements/data types.

    The differentiation I'm thinking of that may be pertinent to performance
    is that structures are created on the stack versus on the heap for class
    instances. My guess is that for small sets of data, perhaps the
    structure is better and the opposite is true for returning large sets of
    data. I really do not know.

    I have not found any discussion of such in MSDN or otherwise. I'm
    curious to know if anyone has any remotely conclusive evidence or
    experience. Thanks.

    Just Me Guest

  5. #4

    Default Re: Class v. Structure

    Hello Just,

    JM> The differentiation I'm thinking of that may be pertinent to
    JM> performance is that structures are created on the stack versus on
    JM> the heap for class instances. My guess is that for small sets of
    JM> data, perhaps the structure is better and the opposite is true for
    JM> returning large sets of data. I really do not know.

    Yep, everything is all right as u described.

    it depends on how u treats that data afterwards u get them? If it's in vast
    using - use class,
    if it's only returning data with short period of life - use stucture.

    Web-service doesnt' have sense in this way

    ---
    WBR,
    Michael Nemtsev



    Michael Nemtsev Guest

  6. #5

    Default Re: Class v. Structure

    Thank you for your replies and confirming my thoughts. Best regards.

    Michael Nemtsev wrote:
    Just Me Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139