Add some profiling code; almost ready to specialize lddynamic/stdynamic