Can you make this code run any faster?
public static class GuidExtensions { public static Guid TransfromToGuidWithProperSorting(this byte[] bytes) { return new Guid(new[] { bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15], bytes[8], bytes[9], bytes[6], bytes[7], bytes[4], bytes[5], bytes[0], bytes[1], bytes[2], bytes[3], }); } public static byte[] TransformToValueForEsentSorting(this Guid guid) { var bytes = guid.ToByteArray(); return new[] { bytes[12], bytes[13], bytes[14], bytes[15], bytes[10], bytes[11], bytes[8], bytes[9], bytes[6], bytes[7], bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], }; } }
Just to note, this is stupid micro optimization trick, it takes 0.00008 ms to execute right now, which is plenty fast enough, but it is fun to play with it.

Comments
Comment preview