Hi! ----
Here is an old RFE which was sitting on my desk since a while: AFAIK it may be nice to add a -O flag to "shcomp" to enable some kind of optimisations which are usually to heavywheight during normal shell execution since they take too much time. For example these optimisations may be nice: - Remove unneccesary blanks in arithmetric expressions, e.g. $ print '(( sin( 5 ) ))' | shcomp >shbin # currently creates a larger execuitable than $ print '((sin(5)))' | shcomp >shbin # - the option -O should strip that - Convert static arithmetric expressions like 1+1 or sin(cos(5)) into integer or hexfloat strings and store these in the compiled shell code (goal is to reduce execution time). - String "peephole optimisations": Convert quoted strings like x\ b\ i\ p\ z into a common, shorter form (like "x b i p z" or $'x b i p z'). This applies mainly to string literals which use weired quoting in shell scripts to cover multiple lines, don't know about $'...' literals or somehow else have weired intentions - Removal of line continuations: Line continutations with \ should be removed (to save space, LINENO should not be guranteed to be exact with -O) - Replace statements like "while true ; do" with "for ((;;)) ; do", assuming the 2nd form is a bit faster. - Use a "hardcoded" path for variable declarations like "float", "integer", "typeset" (plain string), assuming no value assignments happen and no extra options are set. Right now the whole code always goes through |b_typeset()| and calls very heavywheight functions like |ast_getopts()| each time. IMO shcomp -O should try to optimise this away (maybe by using extra special builtins to declare such variables without going through all the heavywheight code). - <insert more ideas> Any comments/ideas/suggestions ? ---- Bye, Roland -- __ . . __ (o.\ \/ /.o) [email protected] \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 3992797 (;O/ \/ \O;) _______________________________________________ ast-developers mailing list [email protected] https://mailman.research.att.com/mailman/listinfo/ast-developers
