From 07b973a31261d6b65bbfa744e5395188c1d8d45b Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Fri, 16 Jun 2017 22:28:36 +0200 Subject: [PATCH] RBA performance Some small performance improvement by avoiding calls to "initialize" where not required. --- src/rba/rbaConvert.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rba/rbaConvert.cc b/src/rba/rbaConvert.cc index 53aac2d81..2422cc145 100644 --- a/src/rba/rbaConvert.cc +++ b/src/rba/rbaConvert.cc @@ -208,7 +208,7 @@ object_to_ruby (void *obj, const gsi::ClassBase *cls, bool pass_obj, bool is_con // of the exposed property. Hence copying is safer. // create a instance and copy the value - ret = rba_class_new_instance_checked (0, 0, ruby_cls (clsact)); + ret = rb_obj_alloc (ruby_cls (clsact)); Proxy *p = 0; Data_Get_Struct (ret, Proxy, p); clsact->assign (p->obj (), obj); @@ -238,7 +238,7 @@ object_to_ruby (void *obj, const gsi::ClassBase *cls, bool pass_obj, bool is_con // TODO: we will create a fresh object here, delete it again and link the // reference to the existing object to the Ruby object. This is not quite // efficient - we should avoid creating and deleting a dummy object first. - ret = rba_class_new_instance_checked (0, 0, ruby_cls (clsact)); + ret = rb_obj_alloc (ruby_cls (clsact)); Proxy *p = 0; Data_Get_Struct (ret, Proxy, p); p->set (obj, pass_obj, is_const /*const*/, can_destroy /*can_destroy*/, ret);