Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] FP's and HyperThreading Processors
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-06-14 (06:11)
From: Ville-Pertti Keinonen <will@e...>
Subject: Re: [Caml-list] FP's and HyperThreading Processors

> P4 linked into the program. On the old P2 system, this code spend 
> roughly
> 60% of its time inside that vendor code for FFT's. This is no longer 
> true,
> as other tests show very high performance of just those vendor 
> routines.

Does calling from OCaml affect the performance of the FFTs?

You presumably use your own C wrappers to access the vendor code from 
your OCaml code - do you align the stack?

For floating point intensive code, lack of alignment can cause 
significant differences in performance.  I remember seeing 40% 
differences (worst case) in performance when I ran into this several 
years ago, and I don't think the situation has improved with more 
recent cpus.

OCaml currently doesn't ensure more than word alignment for stack or 
allocations on i386, so you are going to have suboptimal performance 
for any floating point code written in OCaml (as well as float arrays 
allocated in OCaml but manipulated elsewhere).  However, if you're 
calling external code (presumably compiled in an alignment-preserving 
way), you should at least try ensuring that the stack is aligned to a 
64-bit boundary (or 128-bit boundary if SSE is used for anything) in 
case that affects performance.

If you're actually making heavy use of hyperthreading, it may make 
memory access patterns less uniform and performance highly 
unpredictable.  Have you tried comparing performance with and without 
hyperthreading enabled?

Anyway, it sounds like you might be running into several issues.  The 
only certain way to find out which are the most significant ones is to 
do large amounts of profiling and testing.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: