Skip to content

Commit 9e6fe56

Browse files
authored
Merge pull request #387 from godot-rust/qol/cached-function-pointers
Cache function pointers in global tables
2 parents 82bcf30 + 0c89812 commit 9e6fe56

File tree

17 files changed

+1361
-454
lines changed

17 files changed

+1361
-454
lines changed

godot-bindings/src/watch.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@ impl StopWatch {
2626
}
2727
}
2828

29-
pub fn record(&mut self, what: &'static str) {
29+
pub fn record(&mut self, what: impl Into<String>) {
3030
let now = Instant::now();
3131
let duration = now - self.last_instant;
32+
let name = what.into();
33+
3234
self.last_instant = now;
33-
self.lwidth = usize::max(self.lwidth, what.len());
34-
self.metrics.push(Metric {
35-
name: what,
36-
duration,
37-
});
35+
self.lwidth = usize::max(self.lwidth, name.len());
36+
self.metrics.push(Metric { name, duration });
3837
}
3938

4039
pub fn write_stats_to(self, to_file: &Path) {
@@ -48,7 +47,7 @@ impl StopWatch {
4847
}
4948
let rwidth = log10(total.as_millis());
5049
let total_metric = Metric {
51-
name: "total",
50+
name: "total".to_string(),
5251
duration: total,
5352
};
5453

@@ -79,6 +78,6 @@ fn log10(n: u128) -> usize {
7978
}
8079

8180
struct Metric {
82-
name: &'static str,
81+
name: String,
8382
duration: Duration,
8483
}

godot-codegen/src/api_parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub struct Class {
6767
pub is_refcounted: bool,
6868
pub is_instantiable: bool,
6969
pub inherits: Option<String>,
70-
// pub api_type: String,
70+
pub api_type: String,
7171
pub constants: Option<Vec<ClassConstant>>,
7272
pub enums: Option<Vec<Enum>>,
7373
pub methods: Option<Vec<ClassMethod>>,

0 commit comments

Comments
 (0)