I've often wondered what the best approach is for this. I find myself combining two lists a and b of the same length in this way quite frequently. I have always used Transpose[{a,b}], but wondered if that was the most efficient way to do it. It seems like it would require moving around a lot of stuff in memory.
So I tested the speed of the solutions shown here, as well as checked whether they preserved packed arrays.
Needs["Developer`"]
a=RandomInteger[1000000000,1000000];
b=Range[1000000];
PackedArrayQ@a
True
PackedArrayQ@b
True
Timing[c=Thread[{a,b}];]
PackedArrayQ@c
{0.278477,Null}
False
Timing[c=Transpose[{a,b}];]
PackedArrayQ@c
{0.011906,Null}
True
Timing[c=MapIndexed[{#1,First@#2}&,a];]
PackedArrayQ@c
{1.256647,Null}
False
Timing[c=MapThread[List,{a,b}];]
PackedArrayQ@c
{0.371252,Null}
False
Timing[c=Inner[List,a,b,List];]
PackedArrayQ@c
{0.274188,Null}
False
I had high hopes for Thread. However Transpose is the clear winner, and the only one that preserves packed arrays.
Any other solutions we should try?