Skip to content

Commit

Permalink
Note on optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
keithw committed Mar 13, 2012
1 parent fbd17a1 commit ee9540b
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README.md
Expand Up @@ -102,7 +102,6 @@ Getting Mosh
[Boost]: http://www.boost.org/
[IO::Pty]: http://search.cpan.org/~toddr/IO-Tty/Pty.pm


Usage
-----

Expand Down Expand Up @@ -138,6 +137,28 @@ How it works
and server. By default, `mosh` uses a port number between 60000 and
61000, but the user can select a particular port with the -p option.

Advice to distributors
----------------------

A note on compiler flags: Mosh is security-sensitive code. When making
automated builds for a binary package, we recommend passing the option
`--enable-compiler-warnings=error` to ./configure. On GNU/Linux with
gcc and a system boost, the package should compile cleanly with
-Werror. Please report a bug if it doesn't.

Mosh ships with a default optimization setting of `-O2`. Some
distributors have asked about changing this to `-Os` (which causes a
compiler to prefer space optimizations to time optimization). We have
benchmarked mosh with g++ 4.6 and clang++ 2.9 to see if `-Os` might be
preferable. In both cases, -Os did produce a smaller binary (by up to
40%, saving a few hundred kilobytes), but at a considerable cost to
mosh's performance -- about 28-31% for both compilers, or similar to a
typical net benefit from enabling optimization. While Mosh is not
especially CPU intensive and mostly sits idle when the user is not
typing, our recommendation to distributors would be to stay with the
default of `-O2` unless saving space on disk is particularly
important.

More info
---------

Expand Down

0 comments on commit ee9540b

Please sign in to comment.