120 likes | 213 Views
Effectiveness of an Automatic Insertion of Safe Memory Reuses into ML-like Programs. Oukseh Lee and Kwangkeun Yi {oukseh; kwang}@ropas.snu.ac.kr Seoul National University January 12, 2004. *.
E N D
Effectiveness of an Automatic Insertion of Safe Memory Reuses into ML-like Programs Oukseh Lee and Kwangkeun Yi {oukseh; kwang}@ropas.snu.ac.kr Seoul National University January 12, 2004
* Oukseh Lee, Hongseok Yang, and Kwangkeun Yi. Inserting Safe Memory Reuse Commands into ML-like Programs. In Proceedings of the Annual International Static Analysis Symposium, volume 2694 of Lecture Notes in Computer Science, pp. 171-188, San Diego, California, June 2003. Question • Our SAS 2003 paper* presented • an algorithm to replaceallocations by memory reuse (or destructive update); and • some promising yet preliminary experiment numbers. • When and how much is it cost-effective? • Space & time-wise. • Before launching it inside our nML compiler.
4 result 1 2 3 fun insert b i l = case l of [] => i::[] | h::t => if i<h then i::l else let z = insert b i t in free l when b; h::z l Example: insert insert 5 l 4 6 1 2 3 5 result 4 1 2 3 fun insert i l = case l of [] => i::[] | h::t => if i<h then i::l else let z = insert i t in h::z
Analysis & Transformation Cost slope=1.46 1,500~29,000 lines/sec
Reuse Ratio 3.8%~88.6% of allocations are avoided.
Memory Peak Reduction much reuse = much peak reduction 0.0%~71.9% peak reduction
Difference in Live Cells sieve (85.7%) qsort (83.7%) merge (50.0%) msort (88.6%)
Difference in Live Cells queens (5.2%) kb (3.8%) k-eval (31.5%) nucleic (17.7%)
Difference in Live Cells life (8.7%) mirage (84.4%)
50.0% 83.7% 81.3% 64.5% 16.0% 17.5% 5.2% -6.0% -6.7% 88.6% 50.7% 3.4% 84.4% 3.9% -21.6% 31.5% 1.2% -5.3% 3.8% -3.9% -4.9% 50.0% 83.7% 71.7% 69.9% 4.2% 25.4% 5.2% -3.0% -6.1% 88.6% 54.4% 10.3% 84.4% 5.2% -42.9% 31.5% 1.7% -17.1% 3.8% -5.0% -7.5% GC-time & Runtime Changes -1.6%~88.5% GC-time reduction -42.9%~25.4% runtime reduction High reuse ratio & Big GC-time portion: runtime reduction Low reuse ratio: flags overhead High reuse ratio & Small GC-time portion: expansive reuse in the Objective Caml system
GC-time & Runtime Changes much reuse = much GC-time reduction much reuse & big GC-time portion = much runtime reduction
high reuse ratio memory peak reduction runtime speedup Answer transformation result program performance program not much sharing + big GC-time portion