equal
deleted
inserted
replaced
799 end; |
799 end; |
800 |
800 |
801 |
801 |
802 |
802 |
803 (** timing **) |
803 (** timing **) |
|
804 |
|
805 (*a conditional timing function: applies f to () and, if the flag is true, |
|
806 prints its runtime*) |
|
807 fun cond_timeit flag f = |
|
808 if flag then |
|
809 let val start = startTiming() |
|
810 val result = f () |
|
811 in |
|
812 writeln (endTiming start); result |
|
813 end |
|
814 else f (); |
804 |
815 |
805 (*unconditional timing function*) |
816 (*unconditional timing function*) |
806 fun timeit x = cond_timeit true x; |
817 fun timeit x = cond_timeit true x; |
807 |
818 |
808 (*timed application function*) |
819 (*timed application function*) |