Kostas, Yes, I think it is worth rewriting as t := M[i,j]; t.u:=t.f/t.m What you save are 4 subscript operators because M[i,j] is M[i][j]. In a tight loop I think they'd matter. I'd be curious to know how much. [] is slower than . but of comparable speed to := and / so I would guess your rewrite might speed up from 0-50%, but subscripting may also allocate memory in surprising ways (silly historical/lazy implementation artifact) so you may get a slight extra speedup bonus for fewer garbage collections.
"common subexpression elimination" is a common optimization that should be built-in to our code generator (icont) but isn't. Perhaps if we rewrite icont in Unicon we will be in a position to do such standard optimizations, but I think current icont does almost no optimizations. Incidentally, Gregg Townsend did a cool peephole optimizer for ucode awhile back; we ought to add similar capabilities if they did not end up integrated into icont. BTW, Federico: assignment does not create a new record instance or copy, it creates an alias! Implicit pointer reference semantics in Icon/Unicon. :-) Clint ------------------------------------------------------- This sf.net email is sponsored by: To learn the basics of securing your web site with SSL, click here to get a FREE TRIAL of a Thawte Server Certificate: http://www.gothawte.com/rd524.html _______________________________________________ Unicon-group mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/unicon-group
