caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Package compilation and debug mode
@ 2016-03-12 21:35 Daniel Bünzli
  2016-03-13 19:16 ` Ivan Gotovchits
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Daniel Bünzli @ 2016-03-12 21:35 UTC (permalink / raw)
  To: platform; +Cc: OCaml List

Hello,  

I'd like to know what the consensus is about distributing packages that always compile in debug mode. It seems that some persons do want to have debug always enabled [1,2], but the discussion is not clear cut [1]. 

By default all my packages are released with -g disabled. It seems easy enough to have an opam switch (even the official one) that automatically enables the flag.

So I think OCaml's opam repository should have a policy here. The answer should also take system package managers into account since those pull directly from the tarballs (if this document [3] is still in use for debian it seems they do require compilation with debug mode).

Personally I don't have an opinion about it, I'm rather seeking an answer here.

Best,

Daniel

[1] http://caml.inria.fr/mantis/view.php?id=6728
[2] http://rgrinberg.com/blog/2016/02/26/opam-package-checklist/
[3] http://pkg-ocaml-maint.alioth.debian.org/ocaml_packaging_policy.html/c305.html#AEN307



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Package compilation and debug mode
  2016-03-12 21:35 [Caml-list] Package compilation and debug mode Daniel Bünzli
@ 2016-03-13 19:16 ` Ivan Gotovchits
  2016-03-14  7:19   ` Mark Shinwell
  2016-03-23  9:43 ` Daniel Bünzli
  2016-03-23 10:02 ` Thomas Gazagnaire
  2 siblings, 1 reply; 9+ messages in thread
From: Ivan Gotovchits @ 2016-03-13 19:16 UTC (permalink / raw)
  To: Daniel Bünzli; +Cc: platform, OCaml List

It looks like, that currently the `-g` option has no performance cost at all (correct me if I’m wrong). Presumably, there is some increase in the package size, but who cares. With these premises, I think it would be a good policy to distribute packages with `-g` flag enabled.  

> On Mar 12, 2016, at 4:35 PM, Daniel Bünzli <daniel.buenzli@erratique.ch> wrote:
> 
> Hello,  
> 
> I'd like to know what the consensus is about distributing packages that always compile in debug mode. It seems that some persons do want to have debug always enabled [1,2], but the discussion is not clear cut [1]. 
> 
> By default all my packages are released with -g disabled. It seems easy enough to have an opam switch (even the official one) that automatically enables the flag.
> 
> So I think OCaml's opam repository should have a policy here. The answer should also take system package managers into account since those pull directly from the tarballs (if this document [3] is still in use for debian it seems they do require compilation with debug mode).
> 
> Personally I don't have an opinion about it, I'm rather seeking an answer here.
> 
> Best,
> 
> Daniel
> 
> [1] http://caml.inria.fr/mantis/view.php?id=6728
> [2] http://rgrinberg.com/blog/2016/02/26/opam-package-checklist/
> [3] http://pkg-ocaml-maint.alioth.debian.org/ocaml_packaging_policy.html/c305.html#AEN307
> 
> 
> 
> -- 
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Package compilation and debug mode
  2016-03-13 19:16 ` Ivan Gotovchits
@ 2016-03-14  7:19   ` Mark Shinwell
  2016-03-14  8:14     ` whitequark
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Shinwell @ 2016-03-14  7:19 UTC (permalink / raw)
  To: Ivan Gotovchits; +Cc: Daniel Bünzli, platform, OCaml List

There is a performance penalty with -g: it makes the raising of
exceptions slower (due to recording of backtraces).   I think that may
be the only difference at present, though I'm not completely sure.

Mark

On 13 March 2016 at 19:16, Ivan Gotovchits <ivg@ieee.org> wrote:
> It looks like, that currently the `-g` option has no performance cost at all (correct me if I’m wrong). Presumably, there is some increase in the package size, but who cares. With these premises, I think it would be a good policy to distribute packages with `-g` flag enabled.
>
>> On Mar 12, 2016, at 4:35 PM, Daniel Bünzli <daniel.buenzli@erratique.ch> wrote:
>>
>> Hello,
>>
>> I'd like to know what the consensus is about distributing packages that always compile in debug mode. It seems that some persons do want to have debug always enabled [1,2], but the discussion is not clear cut [1].
>>
>> By default all my packages are released with -g disabled. It seems easy enough to have an opam switch (even the official one) that automatically enables the flag.
>>
>> So I think OCaml's opam repository should have a policy here. The answer should also take system package managers into account since those pull directly from the tarballs (if this document [3] is still in use for debian it seems they do require compilation with debug mode).
>>
>> Personally I don't have an opinion about it, I'm rather seeking an answer here.
>>
>> Best,
>>
>> Daniel
>>
>> [1] http://caml.inria.fr/mantis/view.php?id=6728
>> [2] http://rgrinberg.com/blog/2016/02/26/opam-package-checklist/
>> [3] http://pkg-ocaml-maint.alioth.debian.org/ocaml_packaging_policy.html/c305.html#AEN307
>>
>>
>>
>> --
>> Caml-list mailing list.  Subscription management and archives:
>> https://sympa.inria.fr/sympa/arc/caml-list
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Package compilation and debug mode
  2016-03-14  7:19   ` Mark Shinwell
@ 2016-03-14  8:14     ` whitequark
  2016-03-14  8:24       ` Mark Shinwell
  0 siblings, 1 reply; 9+ messages in thread
From: whitequark @ 2016-03-14  8:14 UTC (permalink / raw)
  To: Mark Shinwell; +Cc: Ivan Gotovchits, Daniel Bünzli, platform, OCaml List

On 2016-03-14 10:19, Mark Shinwell wrote:
> There is a performance penalty with -g: it makes the raising of
> exceptions slower (due to recording of backtraces).   I think that may
> be the only difference at present, though I'm not completely sure.

This penalty is only present with OCAMLRUNPARAM=b, which is now on by
default. This is a good thing, because lack of backtraces is something
100% of newcomers trip over; and anyone who dislikes the penalty
can trivially turn it off.

However, -g also inhibits some optimizations along with adding debug 
info.
So it is still not free.

IMO there should be another option, something like -debug-info, that is
equivalent to -g but does not inhibit any optimizations. Then it would
be enabled by default.

> 
> Mark
> 
> On 13 March 2016 at 19:16, Ivan Gotovchits <ivg@ieee.org> wrote:
>> It looks like, that currently the `-g` option has no performance cost 
>> at all (correct me if I’m wrong). Presumably, there is some increase 
>> in the package size, but who cares. With these premises, I think it 
>> would be a good policy to distribute packages with `-g` flag enabled.
>> 
>>> On Mar 12, 2016, at 4:35 PM, Daniel Bünzli 
>>> <daniel.buenzli@erratique.ch> wrote:
>>> 
>>> Hello,
>>> 
>>> I'd like to know what the consensus is about distributing packages 
>>> that always compile in debug mode. It seems that some persons do want 
>>> to have debug always enabled [1,2], but the discussion is not clear 
>>> cut [1].
>>> 
>>> By default all my packages are released with -g disabled. It seems 
>>> easy enough to have an opam switch (even the official one) that 
>>> automatically enables the flag.
>>> 
>>> So I think OCaml's opam repository should have a policy here. The 
>>> answer should also take system package managers into account since 
>>> those pull directly from the tarballs (if this document [3] is still 
>>> in use for debian it seems they do require compilation with debug 
>>> mode).
>>> 
>>> Personally I don't have an opinion about it, I'm rather seeking an 
>>> answer here.
>>> 
>>> Best,
>>> 
>>> Daniel
>>> 
>>> [1] http://caml.inria.fr/mantis/view.php?id=6728
>>> [2] http://rgrinberg.com/blog/2016/02/26/opam-package-checklist/
>>> [3] 
>>> http://pkg-ocaml-maint.alioth.debian.org/ocaml_packaging_policy.html/c305.html#AEN307
>>> 
>>> 
>>> 
>>> --
>>> Caml-list mailing list.  Subscription management and archives:
>>> https://sympa.inria.fr/sympa/arc/caml-list
>>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>> 
>> 
>> --
>> Caml-list mailing list.  Subscription management and archives:
>> https://sympa.inria.fr/sympa/arc/caml-list
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs

-- 
whitequark

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Package compilation and debug mode
  2016-03-14  8:14     ` whitequark
@ 2016-03-14  8:24       ` Mark Shinwell
  0 siblings, 0 replies; 9+ messages in thread
From: Mark Shinwell @ 2016-03-14  8:24 UTC (permalink / raw)
  To: whitequark; +Cc: Ivan Gotovchits, Daniel Bünzli, platform, OCaml List

I think there is a penalty (albeit a lesser one) with -g even if
OCAMLRUNPARAM does not contain "b".  Raising an exception from OCaml
code causes a function call, which it does not otherwise.

Mark

On 14 March 2016 at 08:14, whitequark <whitequark@whitequark.org> wrote:
> On 2016-03-14 10:19, Mark Shinwell wrote:
>>
>> There is a performance penalty with -g: it makes the raising of
>> exceptions slower (due to recording of backtraces).   I think that may
>> be the only difference at present, though I'm not completely sure.
>
>
> This penalty is only present with OCAMLRUNPARAM=b, which is now on by
> default. This is a good thing, because lack of backtraces is something
> 100% of newcomers trip over; and anyone who dislikes the penalty
> can trivially turn it off.
>
> However, -g also inhibits some optimizations along with adding debug info.
> So it is still not free.
>
> IMO there should be another option, something like -debug-info, that is
> equivalent to -g but does not inhibit any optimizations. Then it would
> be enabled by default.
>
>
>>
>> Mark
>>
>> On 13 March 2016 at 19:16, Ivan Gotovchits <ivg@ieee.org> wrote:
>>>
>>> It looks like, that currently the `-g` option has no performance cost at
>>> all (correct me if I’m wrong). Presumably, there is some increase in the
>>> package size, but who cares. With these premises, I think it would be a good
>>> policy to distribute packages with `-g` flag enabled.
>>>
>>>> On Mar 12, 2016, at 4:35 PM, Daniel Bünzli <daniel.buenzli@erratique.ch>
>>>> wrote:
>>>>
>>>> Hello,
>>>>
>>>> I'd like to know what the consensus is about distributing packages that
>>>> always compile in debug mode. It seems that some persons do want to have
>>>> debug always enabled [1,2], but the discussion is not clear cut [1].
>>>>
>>>> By default all my packages are released with -g disabled. It seems easy
>>>> enough to have an opam switch (even the official one) that automatically
>>>> enables the flag.
>>>>
>>>> So I think OCaml's opam repository should have a policy here. The answer
>>>> should also take system package managers into account since those pull
>>>> directly from the tarballs (if this document [3] is still in use for debian
>>>> it seems they do require compilation with debug mode).
>>>>
>>>> Personally I don't have an opinion about it, I'm rather seeking an
>>>> answer here.
>>>>
>>>> Best,
>>>>
>>>> Daniel
>>>>
>>>> [1] http://caml.inria.fr/mantis/view.php?id=6728
>>>> [2] http://rgrinberg.com/blog/2016/02/26/opam-package-checklist/
>>>> [3]
>>>> http://pkg-ocaml-maint.alioth.debian.org/ocaml_packaging_policy.html/c305.html#AEN307
>>>>
>>>>
>>>>
>>>> --
>>>> Caml-list mailing list.  Subscription management and archives:
>>>> https://sympa.inria.fr/sympa/arc/caml-list
>>>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>>>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>>>
>>>
>>>
>>> --
>>> Caml-list mailing list.  Subscription management and archives:
>>> https://sympa.inria.fr/sympa/arc/caml-list
>>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>
> --
> whitequark

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Package compilation and debug mode
  2016-03-12 21:35 [Caml-list] Package compilation and debug mode Daniel Bünzli
  2016-03-13 19:16 ` Ivan Gotovchits
@ 2016-03-23  9:43 ` Daniel Bünzli
  2016-03-23 10:02 ` Thomas Gazagnaire
  2 siblings, 0 replies; 9+ messages in thread
From: Daniel Bünzli @ 2016-03-23  9:43 UTC (permalink / raw)
  To: platform; +Cc: OCaml List

Le samedi, 12 mars 2016 à 22:35, Daniel Bünzli a écrit :
> So I think OCaml's opam repository should have a policy here. The answer should also take system package managers into account since those pull directly from the tarballs (if this document [3] is still in use for debian it seems they do require compilation with debug mode).

Would it be possible to get an official answer from OCaml's OPAM repository managers ?

They are in charge of devising the switches which do allow global addition of compiler options. If global removal is not supported then I think packages should be distributed without -g and default switches should simply add this switch.

Daniel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Package compilation and debug mode
  2016-03-12 21:35 [Caml-list] Package compilation and debug mode Daniel Bünzli
  2016-03-13 19:16 ` Ivan Gotovchits
  2016-03-23  9:43 ` Daniel Bünzli
@ 2016-03-23 10:02 ` Thomas Gazagnaire
  2016-03-23 10:12   ` [Caml-list] [ocaml-platform] " Gabriel Scherer
  2016-03-23 10:23   ` [Caml-list] " Daniel Bünzli
  2 siblings, 2 replies; 9+ messages in thread
From: Thomas Gazagnaire @ 2016-03-23 10:02 UTC (permalink / raw)
  To: Daniel Bünzli; +Cc: platform, OCaml List

> By default all my packages are released with -g disabled. It seems easy enough to have an opam switch (even the official one) that automatically enables the flag.

How do you envision such a global debug flag? As far as I know, there is no configuration-time option to enable that option in the compiler (which would be the cleaner option IMHO). I'd rather avoid using OCAMLPARAM for this. A new opam variable can be created and used in the opam file to pass the debug command (or not) explicitly to the build system, but this will require adapting all the build systems (and ideally a new release of opam, but we can work-around that by setting OPAMVAR_debug in the .comp file).

> So I think OCaml's opam repository should have a policy here. The answer should also take system package managers into account since those pull directly from the tarballs (if this document [3] is still in use for debian it seems they do require compilation with debug mode).
> 
> Personally I don't have an opinion about it, I'm rather seeking an answer here.

I don't have a strong opinion either. I like when packages come with -g by default, but I can understand that the (small) runtime cost can be a problem for deployment scenarios.

Thomas

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] [ocaml-platform] Package compilation and debug mode
  2016-03-23 10:02 ` Thomas Gazagnaire
@ 2016-03-23 10:12   ` Gabriel Scherer
  2016-03-23 10:23   ` [Caml-list] " Daniel Bünzli
  1 sibling, 0 replies; 9+ messages in thread
From: Gabriel Scherer @ 2016-03-23 10:12 UTC (permalink / raw)
  To: Thomas Gazagnaire; +Cc: Daniel Bünzli, platform, OCaml List

The new (4.03)
  ocaml_compiler_internal_params
mechanism might be of use here:
  OCAMLPARAM option passed using a configuration file
  https://github.com/ocaml/ocaml/pull/428

Note that as a software packager I would be fine fetching a %{debug}%
variable and adapt my configure/build chain to handle it. I already
have specific logic for ocaml-native and ocaml-native-tools. But I
wonder whether this approach scales to other preferences one may want
to set globally. (OCAMLPARAM is a kludge, but duplicating it inside
OPAM may not be much better.)

On Wed, Mar 23, 2016 at 11:02 AM, Thomas Gazagnaire
<thomas@gazagnaire.org> wrote:
>> By default all my packages are released with -g disabled. It seems easy enough to have an opam switch (even the official one) that automatically enables the flag.
>
> How do you envision such a global debug flag? As far as I know, there is no configuration-time option to enable that option in the compiler (which would be the cleaner option IMHO). I'd rather avoid using OCAMLPARAM for this. A new opam variable can be created and used in the opam file to pass the debug command (or not) explicitly to the build system, but this will require adapting all the build systems (and ideally a new release of opam, but we can work-around that by setting OPAMVAR_debug in the .comp file).
>
>> So I think OCaml's opam repository should have a policy here. The answer should also take system package managers into account since those pull directly from the tarballs (if this document [3] is still in use for debian it seems they do require compilation with debug mode).
>>
>> Personally I don't have an opinion about it, I'm rather seeking an answer here.
>
> I don't have a strong opinion either. I like when packages come with -g by default, but I can understand that the (small) runtime cost can be a problem for deployment scenarios.
>
> Thomas
> _______________________________________________
> Platform mailing list
> Platform@lists.ocaml.org
> http://lists.ocaml.org/listinfo/platform

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Package compilation and debug mode
  2016-03-23 10:02 ` Thomas Gazagnaire
  2016-03-23 10:12   ` [Caml-list] [ocaml-platform] " Gabriel Scherer
@ 2016-03-23 10:23   ` Daniel Bünzli
  1 sibling, 0 replies; 9+ messages in thread
From: Daniel Bünzli @ 2016-03-23 10:23 UTC (permalink / raw)
  To: Thomas Gazagnaire; +Cc: platform, OCaml List



Le mercredi, 23 mars 2016 à 11:02, Thomas Gazagnaire a écrit :

> > By default all my packages are released with -g disabled. It seems easy enough to have an opam switch (even the official one) that automatically enables the flag.
>  
> How do you envision such a global debug flag? As far as I know, there is no configuration-time option to enable that option in the compiler (which would be the cleaner option IMHO). I'd rather avoid using OCAMLPARAM for this.

I don't know, I think a decent scheme should be figured out by the compiler dev team. It seems there's more than one way of doing this at the moment, see e.g.  

https://github.com/ocaml/ocaml/pull/428
  
> A new opam variable can be created and used in the opam file to pass the debug command (or not) explicitly to the build system, but this will require adapting all the build systems (and ideally a new release of opam, but we can work-around that by setting OPAMVAR_debug in the .comp file).

I don't think this is a reasonable approach. Debug/profile seems rather a property of your switch than an individual package property. Though one could argue that this should still be added so that packages using other tools than the ocaml compilers can abide to the switch property.  

Daniel



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-03-23 10:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-12 21:35 [Caml-list] Package compilation and debug mode Daniel Bünzli
2016-03-13 19:16 ` Ivan Gotovchits
2016-03-14  7:19   ` Mark Shinwell
2016-03-14  8:14     ` whitequark
2016-03-14  8:24       ` Mark Shinwell
2016-03-23  9:43 ` Daniel Bünzli
2016-03-23 10:02 ` Thomas Gazagnaire
2016-03-23 10:12   ` [Caml-list] [ocaml-platform] " Gabriel Scherer
2016-03-23 10:23   ` [Caml-list] " Daniel Bünzli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).