Optimizing wp_get_attachment_image_src

Usually for gallery post types with lots of attachments, you would do it like this:

http://codex.wordpress.org/Template_Tags/get_posts#Show_attachments_for_the_current_post

Inside a “WordPress Loop”:

<?php
$args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID ); 
$attachments = get_posts($args);
if ($attachments) {
    foreach ( $attachments as $attachment ) {
        echo apply_filters( 'the_title' , $attachment->post_title );
        the_attachment_link( $attachment->ID , false );
    }
}
?>

tech