THRIFT-418. rb: Don't do runtime sorting of struct fields


Patch: Ilya Maykov

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1134122 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/rb/ext/struct.c b/lib/rb/ext/struct.c
index 90c4b05..4455c1c 100644
--- a/lib/rb/ext/struct.c
+++ b/lib/rb/ext/struct.c
@@ -58,6 +58,7 @@
 
 #define IS_CONTAINER(ttype) ((ttype) == TTYPE_MAP || (ttype) == TTYPE_LIST || (ttype) == TTYPE_SET)
 #define STRUCT_FIELDS(obj) rb_const_get(CLASS_OF(obj), fields_const_id)
+#define STRUCT_FIELD_IDS(obj) rb_const_get(CLASS_OF(obj), field_ids_const_id)
 
 //-------------------------------------------
 // Writing section
@@ -375,9 +376,7 @@
 
   // iterate through all the fields here
   VALUE struct_fields = STRUCT_FIELDS(self);
-
-  VALUE struct_field_ids_unordered = rb_funcall(struct_fields, keys_method_id, 0);
-  VALUE struct_field_ids_ordered = rb_funcall(struct_field_ids_unordered, sort_method_id, 0);
+  VALUE struct_field_ids_ordered = STRUCT_FIELD_IDS(self);
 
   int i = 0;
   for (i=0; i < RARRAY_LEN(struct_field_ids_ordered); i++) {