Impact of native compilation

Per Bergqvist per@REDACTED
Sat Sep 7 09:16:50 CEST 2002

(Disclaimer: this behaviour might have changed, haven't really checked
it in the current release but anyway ...)                             
I had the same experience regarding loop performance in C vs. Hipe    
erlang and decided to look in to it about a year ago.                 
It looked like hipe did a very good job generating code for the body  
of the function, but did no optimization for                          
recursive calls (i.e. loops). It handled it as any other call.        
After each execution of the "body" hipe called runtime functions to   
allow housekeeping and scheduling.                                    
Unfortunately most functions in erlang are very small and the setup   
overhead for each body call was significant resulting in  very small  
perfomance gains (but still some).                                    
Compare this with an tight optimized (unrolled|coiled|pipelined) loop 
in C doing condition checking on a register flag.                     
This is a bit unfortunate since performance bottlenecks can usually be
tracked down a few inner loops for almost any given system...         
> Hello,                                                              
> We were wondering with Thierry Mallard about the impact of native   
> We tried to compare a big amount of floating point operations (100  
> The result is greatly improved over standard Erlang.                
> The result is also far from the C execution time.                   
> We were wondering why the result was different. Is there many more  
> implied by Erlang ?                                                 
> The test are at the bottom of this email.                           
> I have not yet tested the same example with ETOS. Does someone know 
> expected impact with ETOS ?                                         
> Thank you for you help.                                             
> --                                                                  
> Mickaël Rémond                                                      
> -=-=-=-=-=-                                                         
> Erlang test:                                                        
> Erlang (BEAM) emulator version 2002.09.05 [source] [hipe]           
> Eshell V2002.09.05  (abort with ^G)                                 
> 1> c(test2, [native, {hipe, [o3]}]).                                
> {ok,test2}                                                          
> 2> test2:run().                                                     
> {5820686,ok}                                                        
> ======= >Means 5.8 seconds.                                         
> -=-=-=-=-=-                                                         
> [mremond@REDACTED test]$ g++ -O3 -o testmulti testmulti.cpp          
> [mremond@REDACTED test]$ ./testmulti                                 
> 0.27user 0.00system 0:00.89elapsed 30%CPU (0avgtext+0avgdata        
> 0inputs+0outputs (129major+34minor)pagefaults 0swaps                
> ======= >Means less than 1 second.                                  
Per Bergqvist                                                         
Synapse Systems AB                                                    
Phone: +46 709 686 685                                                
Email: per@REDACTED                                                   

More information about the erlang-questions mailing list