|Anonymous | Login | Signup for a new account||2013-05-23 14:29 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0005201||OCaml||OCamlbuild (the tool)||public||2011-01-04 16:29||2012-12-15 18:11|
|Target Version||4.01.0+dev||Fixed in Version|
|Summary||0005201: Performance issue for ocamlbuild on Windows|
|Description||on Windows system, each command executed by ocambuild is encapsulated in a "bash -C" command which has a non negligeable overhead (~ 0.5s).|
Unless the Filename.quote function is fixed, a simple improvement is to change a line in file ocamlbuild/my_std.ml,
In function sys_command, just replace the line
let cmd = "bash -c "^Filename.quote cmd in
let cmd = "sh -c "^Filename.quote cmd in
ocamlbuild will go much faster on Windows.
|Tags||No tags attached.|
|In the same vein I would also be in favor of not calling the shell when the arguments are either easily quotable or need not to be quoted.|
and because ocamlbuild call the "bash" or the "sh" shell, ocamlbuild does'nt work when call direcly called from a DOS shell.
So this issue is not only a performance issue.
|Yes, however, the recommend way to run OCaml under Windows is inside a Cygwin environment (either with the cygwin-packaged ocaml, or the native win32 ocaml compilers) so that you have a shell and the gnu tools available to work with. Argument quoting is such a mess on windows that I don't think it would be easy to make sure ocamlbuild can rely on cmd.exe under windows...|
|FTR see the discussion and referenced articles at https://forge.ocamlcore.org/tracker/?func=detail&aid=1170&group_id=54&atid=291 [^]|
edited on: 2012-12-15 18:12
I've started to look at the issue a bit more in-depth.
ocamlbuild uses this for different kinds of commands:
1- calls to cp, rm, mkdir, find, ...
2- any command through "run_and_read" or "run_and_open" functions which start a process and retrieve its standard output
1- is probably the biggest performance killer by far, especially on windows. Spawning bash on msys or cygwin takes time and spawning another command will only be slower. These should be pretty easy to implement.
2- is more annoying. The functions "run_and_*" seem to be usable by plugins but maybe not officially (can someone confirm this?). Overall it would be nicer to avoid such functions or reduce their number (some are easy: there's a call to readlink).
There will still be a few calls ("ocamlfind list" for instance) anyway. In ygrek's link, thelema has implemented the necessary quoting in ocaml; would it be possible to include this in the standard library? Unix.exec* functions should also be rewritten to use that quoting.
Moving the run_and_* functions from ocamlbuild to the standard library would probably be good too since they're already in the ocaml sources and are needed by projects which cannot easily use an additional library (ocamlbuild, my yypkg package manager, probably omake, ocamlfind, godi, ...).
So, does removing as many calls to external commands as possible and adding support for proper quoting for processes in the standard library sound like a good way?
PS: this issue should be made linked to "0004981: ocamlbuild/my_std.ml shouldn't call bash" in mantis.
|2011-01-04 16:29||daweil||New Issue|
|2011-01-05 16:19||ertai||Note Added: 0005759|
|2011-01-05 16:19||ertai||Assigned To||=> xclerc|
|2011-01-05 16:19||ertai||Status||new => assigned|
|2012-02-02 15:17||protz||Category||OCamlbuild => OCamlbuild (the tool)|
|2012-07-10 17:17||doligez||Target Version||=> 4.01.0+dev|
|2012-07-31 13:36||doligez||Target Version||4.01.0+dev => 4.00.1+dev|
|2012-09-19 14:57||doligez||Severity||minor => tweak|
|2012-09-19 14:57||doligez||Target Version||4.00.1+dev => 4.01.0+dev|
|2012-09-20 14:11||daweil||Note Added: 0008124|
|2012-09-20 14:17||protz||Note Added: 0008125|
|2012-09-20 15:04||ygrek||Note Added: 0008126|
|2012-12-15 18:05||Camarade_Tux||Note Added: 0008615|
|2012-12-15 18:12||Camarade_Tux||Note Edited: 0008615||View Revisions|
|Copyright © 2000 - 2011 MantisBT Group|