summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-06-29 00:29:49 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-06-29 00:29:49 -0300
commit95047562d743b1c1fdc007432c8a0c145a455c5d (patch)
treef563e5c900c4330fcc602b6e5a721bc63022b253 /core/io
parent2b64f73b0459190d20b2f6de39275ee7979317c4 (diff)
Several performance improvements, mainly in loading and instancing scenes and resources.
A general speedup should be apparent, with even more peformance increase when compiling optimized. WARNING: Tested and it seems to work, but if something breaks, please report.
Diffstat (limited to 'core/io')
-rw-r--r--core/io/http_client.cpp2
-rw-r--r--core/io/ip_address.cpp2
-rw-r--r--core/io/resource_format_binary.cpp2
-rw-r--r--core/io/resource_format_xml.cpp75
4 files changed, 42 insertions, 39 deletions
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index dbd009e319..24012660d2 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -325,7 +325,7 @@ Error HTTPClient::poll(){
if (i==0 && responses[i].begins_with("HTTP")) {
- String num = responses[i].get_slice(" ",1);
+ String num = responses[i].get_slicec(' ',1);
response_num=num.to_int();
} else {
diff --git a/core/io/ip_address.cpp b/core/io/ip_address.cpp
index c5506f1a74..ed5a45c9ef 100644
--- a/core/io/ip_address.cpp
+++ b/core/io/ip_address.cpp
@@ -47,7 +47,7 @@ IP_Address::IP_Address(const String& p_string) {
}
for(int i=0;i<4;i++) {
- field[i]=p_string.get_slice(".",i).to_int();
+ field[i]=p_string.get_slicec('.',i).to_int();
}
}
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 0f6f8a74b1..c6cf631de6 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -1819,7 +1819,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_
Property p;
p.name_idx=get_string_index(F->get().name);
p.value=E->get()->get(F->get().name);
- if (F->get().usage&PROPERTY_USAGE_STORE_IF_NONZERO && p.value.is_zero())
+ if ((F->get().usage&PROPERTY_USAGE_STORE_IF_NONZERO && p.value.is_zero())||(F->get().usage&PROPERTY_USAGE_STORE_IF_NONONE && p.value.is_one()) )
continue;
p.pi=F->get();
diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp
index 36746a4111..b744cbf967 100644
--- a/core/io/resource_format_xml.cpp
+++ b/core/io/resource_format_xml.cpp
@@ -1207,47 +1207,47 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
r_v=Vector3(
- data.get_slice(",",0).to_double(),
- data.get_slice(",",1).to_double(),
- data.get_slice(",",2).to_double()
+ data.get_slicec(',',0).to_double(),
+ data.get_slicec(',',1).to_double(),
+ data.get_slicec(',',2).to_double()
);
} else if (type=="vector2") {
r_v=Vector2(
- data.get_slice(",",0).to_double(),
- data.get_slice(",",1).to_double()
+ data.get_slicec(',',0).to_double(),
+ data.get_slicec(',',1).to_double()
);
} else if (type=="plane") {
r_v=Plane(
- data.get_slice(",",0).to_double(),
- data.get_slice(",",1).to_double(),
- data.get_slice(",",2).to_double(),
- data.get_slice(",",3).to_double()
+ data.get_slicec(',',0).to_double(),
+ data.get_slicec(',',1).to_double(),
+ data.get_slicec(',',2).to_double(),
+ data.get_slicec(',',3).to_double()
);
} else if (type=="quaternion") {
r_v=Quat(
- data.get_slice(",",0).to_double(),
- data.get_slice(",",1).to_double(),
- data.get_slice(",",2).to_double(),
- data.get_slice(",",3).to_double()
+ data.get_slicec(',',0).to_double(),
+ data.get_slicec(',',1).to_double(),
+ data.get_slicec(',',2).to_double(),
+ data.get_slicec(',',3).to_double()
);
} else if (type=="rect2") {
r_v=Rect2(
Vector2(
- data.get_slice(",",0).to_double(),
- data.get_slice(",",1).to_double()
+ data.get_slicec(',',0).to_double(),
+ data.get_slicec(',',1).to_double()
),
Vector2(
- data.get_slice(",",2).to_double(),
- data.get_slice(",",3).to_double()
+ data.get_slicec(',',2).to_double(),
+ data.get_slicec(',',3).to_double()
)
);
@@ -1256,14 +1256,14 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
r_v=AABB(
Vector3(
- data.get_slice(",",0).to_double(),
- data.get_slice(",",1).to_double(),
- data.get_slice(",",2).to_double()
+ data.get_slicec(',',0).to_double(),
+ data.get_slicec(',',1).to_double(),
+ data.get_slicec(',',2).to_double()
),
Vector3(
- data.get_slice(",",3).to_double(),
- data.get_slice(",",4).to_double(),
- data.get_slice(",",5).to_double()
+ data.get_slicec(',',3).to_double(),
+ data.get_slicec(',',4).to_double(),
+ data.get_slicec(',',5).to_double()
)
);
@@ -1272,7 +1272,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
Matrix32 m3;
for (int i=0;i<3;i++) {
for (int j=0;j<2;j++) {
- m3.elements[i][j]=data.get_slice(",",i*2+j).to_double();
+ m3.elements[i][j]=data.get_slicec(',',i*2+j).to_double();
}
}
r_v=m3;
@@ -1282,7 +1282,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
Matrix3 m3;
for (int i=0;i<3;i++) {
for (int j=0;j<3;j++) {
- m3.elements[i][j]=data.get_slice(",",i*3+j).to_double();
+ m3.elements[i][j]=data.get_slicec(',',i*3+j).to_double();
}
}
r_v=m3;
@@ -1292,24 +1292,24 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
Transform tr;
for (int i=0;i<3;i++) {
for (int j=0;j<3;j++) {
- tr.basis.elements[i][j]=data.get_slice(",",i*3+j).to_double();
+ tr.basis.elements[i][j]=data.get_slicec(',',i*3+j).to_double();
}
}
tr.origin=Vector3(
- data.get_slice(",",9).to_double(),
- data.get_slice(",",10).to_double(),
- data.get_slice(",",11).to_double()
+ data.get_slicec(',',9).to_double(),
+ data.get_slicec(',',10).to_double(),
+ data.get_slicec(',',11).to_double()
);
r_v=tr;
} else if (type=="color") {
r_v=Color(
- data.get_slice(",",0).to_double(),
- data.get_slice(",",1).to_double(),
- data.get_slice(",",2).to_double(),
- data.get_slice(",",3).to_double()
+ data.get_slicec(',',0).to_double(),
+ data.get_slicec(',',1).to_double(),
+ data.get_slicec(',',2).to_double(),
+ data.get_slicec(',',3).to_double()
);
} else if (type=="node_path") {
@@ -1674,8 +1674,8 @@ void ResourceInteractiveLoaderXML::open(FileAccess *p_f) {
ERR_FAIL();
}
- int major = version.get_slice(".",0).to_int();
- int minor = version.get_slice(".",1).to_int();
+ int major = version.get_slicec('.',0).to_int();
+ int minor = version.get_slicec('.',1).to_int();
if (major>VERSION_MAJOR) {
@@ -2607,9 +2607,12 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res
String name = PE->get().name;
Variant value = res->get(name);
- if (PE->get().usage&PROPERTY_USAGE_STORE_IF_NONZERO && value.is_zero())
+
+
+ if ((PE->get().usage&PROPERTY_USAGE_STORE_IF_NONZERO && value.is_zero())||(PE->get().usage&PROPERTY_USAGE_STORE_IF_NONONE && value.is_one()) )
continue;
+
write_property(name,value);
}