mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Also use Rc for langtype::Type::Array
This is rarely used, but using Rc here like elsewhere allows us to elide a few unneccessary memory allocations when copying such types. The speed impact is not measurable though. With heaptrack I see that we get rid of the last ~7600 allocations in my benchmark when cloning Type.
This commit is contained in:
parent
fd0eb01c55
commit
0abfb056a1
7 changed files with 14 additions and 11 deletions
|
@ -1885,7 +1885,7 @@ pub fn type_from_node(
|
|||
} else if let Some(object_node) = node.ObjectType() {
|
||||
type_struct_from_node(object_node, diag, tr, None, None)
|
||||
} else if let Some(array_node) = node.ArrayType() {
|
||||
Type::Array(Box::new(type_from_node(array_node.Type(), diag, tr)))
|
||||
Type::Array(Rc::new(type_from_node(array_node.Type(), diag, tr)))
|
||||
} else {
|
||||
assert!(diag.has_errors());
|
||||
Type::Invalid
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue