* [Caml-list] optimum class initializer functions?
@ 2002-04-02 21:46 james woodyatt
2002-04-15 11:44 ` Xavier Leroy
0 siblings, 1 reply; 2+ messages in thread
From: james woodyatt @ 2002-04-02 21:46 UTC (permalink / raw)
To: The Trade
everyone--
I've noticed that using a class where a module would suffice produces
substantially larger native code objects.
I haven't looked closely enough to know all the details, but it looks
like object creation costs about the same as record creation. All the
extra space appears to be in the class initializer functions and the
static data they require. Seems like a fair trade, but I still have
questions.
1) Is there any room for improvement in the space requirements of
class implementations generated by the compilers?
2) Are there any idioms to avoid that greatly increase the space
requirements of classes without offering any benefit in time or
code maintenance?
If no ones wants to answer these question, then I suppose I will get
around to investigating the issue myself after awhile.
--
j h woodyatt <jhw@wetware.com>
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] optimum class initializer functions?
2002-04-02 21:46 [Caml-list] optimum class initializer functions? james woodyatt
@ 2002-04-15 11:44 ` Xavier Leroy
0 siblings, 0 replies; 2+ messages in thread
From: Xavier Leroy @ 2002-04-15 11:44 UTC (permalink / raw)
To: james woodyatt; +Cc: The Trade
> I've noticed that using a class where a module would suffice produces
> substantially larger native code objects.
This has been my experience too, and is a bit of a concern for me.
> I haven't looked closely enough to know all the details, but it looks
> like object creation costs about the same as record creation. All the
> extra space appears to be in the class initializer functions and the
> static data they require. Seems like a fair trade, but I still have
> questions.
>
> 1) Is there any room for improvement in the space requirements of
> class implementations generated by the compilers?
I can imagine a couple of simple changes that could reduce slightly the
size of the class initializer code. But nothing drastic yet.
> 2) Are there any idioms to avoid that greatly increase the space
> requirements of classes without offering any benefit in time or
> code maintenance?
Apparently, most of the overhead is present even for very simple
classes (object ... end, without inheritance), so I don't think the
programming style impacts code size significantly.
- Xavier Leroy
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-04-15 11:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-02 21:46 [Caml-list] optimum class initializer functions? james woodyatt
2002-04-15 11:44 ` Xavier Leroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox