caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Thorsten Ohl <ohl@physik.uni-wuerzburg.de>
To: caml-list@inria.fr
Cc: malc <malc@pulsesoft.com>
Subject: [Caml-list] Specialization (was: Inlining across functors)
Date: Tue, 20 Aug 2002 00:06:20 +0200	[thread overview]
Message-ID: <15713.27612.63106.168053@wptx47.physik.uni-wuerzburg.de> (raw)
In-Reply-To: <Pine.LNX.4.44.0208200115290.11439-100000@home.oyster.ru>

malc  <malc@pulsesoft.com> writes:

> With http://algol.prosalg.no/~malc/code/patches/specfun.tar.gz 
> (patch against 3.04) you will get this instead:
> 
> *** Linearized code                                                             
> Opt_f2_72:                                                                      
>   A/11[%ecx] := [env/10[%ecx] + 12]                                             
>   A/12[%ecx] := [A/11[%ecx]]                                                    
>   tailcall "Opt_f_62" R/0[%eax]                                                 
>   R/1[%ebx]                                                                     
>   R/2[%ecx]   

Neat!

> What will be specialized: frist order non-curried functors

Unfortunately, the cases where my code would benefit most are all
curried and or higher-order functors.  E.g., I have beauties like

    module Tagged (Tagger : Tagger) (PT : Tuple.Poly)
	(Stat : Stat_Maker) (T : Topology.T with type 'a children = 'a PT.t)
	(P : Momentum.T) (M : Model.T) =
      struct 
	...
      end

where the signature Momentum.T can be implemented by simple bitmask
operations and since it is used _very_ often, specialization would
help a great deal.  The situation for symoblic algebra is similar.

I guess that the major obstacle for generalizing your approach to
specialization is in preventing code bloat.  Or am I wrong?

Fine-grained control for specialization (like your syntax extension)
at the point of functor application would be very useful.  The above
code could probably gain a constant factor larger than 10, if I could
specialize curried and higher-order functors. [At crunch time, I can
do this by hand of course, but--also for educational reasons--it would
be nice to let the compiler take care of this.]

Cheers,
-Thorsten
-- 
Thorsten Ohl, Physics Dept., Wuerzburg Univ. -- ohl@physik.uni-wuerzburg.de
http://theorie.physik.uni-wuerzburg.de/~ohl/     [<=== PGP public key here]
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2002-08-20 13:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-18 17:17 [Caml-list] O'Caml vs C++: a little benchmark Oleg
2002-08-18 18:00 ` William Chesters
2002-08-18 19:06   ` Oleg
2002-08-18 21:37     ` William Chesters
2002-08-19 13:02   ` Xavier Leroy
2002-08-19 13:58     ` [Caml-list] Inlining across functors (was: O'Caml vs C++: a little benchmark) Thorsten Ohl
2002-08-19 21:16       ` malc
2002-08-19 22:06         ` Thorsten Ohl [this message]
2002-08-20  6:35           ` [Caml-list] Re: Specialization (was: Inlining across functors) malc
2002-08-20  6:25         ` [Caml-list] Inlining across functors (was: O'Caml vs C++: a little benchmark) malc
2002-08-19 14:39     ` [Caml-list] O'Caml vs C++: a little benchmark Oleg
2002-08-19 15:15     ` William Chesters
2002-08-18 19:16 ` Markus Mottl
2002-08-18 19:58   ` Oleg
2002-08-18 22:59     ` Markus Mottl
2002-08-19 13:12 ` malc
2002-08-19 13:22 ` malc
2002-08-23 21:05 ` John Max Skaller
2002-08-23 21:35   ` Oleg
2002-08-28 13:47     ` John Max Skaller
2002-08-28 14:34       ` Alain Frisch
2002-08-28 17:23       ` inlining tail-recursive functions (Re: [Caml-list] O'Caml vs C++: a little benchmark) Oleg
2002-08-31  1:13         ` John Max Skaller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15713.27612.63106.168053@wptx47.physik.uni-wuerzburg.de \
    --to=ohl@physik.uni-wuerzburg.de \
    --cc=caml-list@inria.fr \
    --cc=malc@pulsesoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).