Commit graph

33 commits

Author SHA1 Message Date
Olivier Goffart
cc46811d95 Fix layout property set in when deriving components
The layout pass needs to see when going over the layout, that these
properties are set. So inline the element that sets these properties if
they are not set in the base.

Fixes #8091
2025-04-23 09:23:07 +02:00
Olivier Goffart
ed179cd5b1
Refactoring: get rid in the callable in the Expression tree
Have a special node for them in FunctionCall
2025-01-24 20:26:35 +01:00
Olivier Goffart
2ea482da49 Compiler: Change a new error from 1.9 to a warning
To keep compatibility with existing Slint code

Commit 53e79000a4 added a call to
LayoutConstraints::new which is shown to produce error in the crater
run.
2024-12-06 23:04:26 +01:00
Milian Wolff
f6da161dbb
Reduce SmolStr <-> &str conversions and copies (#6688)
SmolStr has an Arc internally for large strings. This allows
cheap copies of large strings, but we lose that ability
when we convert the SmolStr to a &str and then reconstruct a
SmolStr from that slice.

I was hoping for some larger gains here, considering the impact
of this code change, but it only removes ~50k allocations,
while the impact on the runtime is not noticeable at all.

Still, I believe this is the right thing to do.

Before:
```
        allocations:            2338981

  Time (mean ± σ):     988.3 ms ±  17.9 ms    [User: 690.2 ms, System: 206.4 ms]
  Range (min … max):   956.4 ms … 1016.3 ms    10 runs
```

After:
```
        allocations:            2287723

  Time (mean ± σ):     989.8 ms ±  23.2 ms    [User: 699.2 ms, System: 197.6 ms]
  Range (min … max):   945.3 ms … 1021.4 ms    10 runs
```
2024-11-19 10:07:16 +01:00
Milian Wolff
79e1592b9f Intern some more common types
This is just for completeness, we "only" save ~13k allocations
with no measurable speed impact:

Before:
```
  Time (mean ± σ):      1.019 s ±  0.033 s    [User: 0.716 s, System: 0.203 s]
  Range (min … max):    0.957 s …  1.061 s    10 runs

        allocations:            2679001

```

After:
```
  Time (mean ± σ):      1.015 s ±  0.015 s    [User: 0.715 s, System: 0.201 s]
  Range (min … max):    0.997 s …  1.038 s    10 runs

        allocations:            2666889
```
2024-10-28 09:39:54 +01:00
Milian Wolff
69c68b22b2 Also wrap langtype::Type::Struct in an Rc
This makes copying such types much cheaper and will allow us to
intern common struct types in the future too. This further
drops the sample cost for langtype.rs from ~6.6% down to 4.0%.

We are now also able to share/intern common struct types.

Before:
```
  Time (mean ± σ):      1.073 s ±  0.021 s    [User: 0.759 s, System: 0.215 s]
  Range (min … max):    1.034 s …  1.105 s    10 runs

        allocations:            3074261
```

After:
```
  Time (mean ± σ):      1.034 s ±  0.026 s    [User: 0.733 s, System: 0.201 s]
  Range (min … max):    1.000 s …  1.078 s    10 runs

        allocations:            2917476
```
2024-10-28 09:39:54 +01:00
Olivier Goffart
6717e627a1 Fix panic when a layout constraint has an Expression::Invalid as binding
We can detect this case earlier

Fix #6590
2024-10-22 09:35:57 +02:00
Milian Wolff
0f6c3a4fd7 Use SmolStr in more places of the compiler infrastructure
This removes a lot of allocations and speeds up the compiler step
a bit. Sadly, this patch is very invasive as it touches a lot of
files. That said, each individual hunk is pretty trivial.

For a non-trivial real-world example, the impact is significant,
we get rid of ~29% of all allocations and improve the runtime by
about 4.8% (measured until the viewer loop would start).

Before:
```
Benchmark 1: ./target/release/slint-viewer ../slint-perf/app.slint
  Time (mean ± σ):     664.2 ms ±   6.7 ms    [User: 589.2 ms, System: 74.0 ms]
  Range (min … max):   659.0 ms … 682.4 ms    10 runs

        allocations:            4886888
        temporary allocations:  857508
```

After:
```
Benchmark 1: ./target/release/slint-viewer ../slint-perf/app.slint
  Time (mean ± σ):     639.5 ms ±  17.8 ms    [User: 556.9 ms, System: 76.2 ms]
  Range (min … max):   621.4 ms … 666.5 ms    10 runs

        allocations:            3544318
        temporary allocations:  495685
```
2024-10-17 18:04:58 +02:00
Olivier Goffart
53e79000a4
Layouting: Take in account explicit constraints when generating layout info base on content (#6306)
Fixes #6285

ChangeLog: Fixed geometry constraints when they are partially infered
from the content, and partially infered from the explicit constraints
2024-09-30 10:57:23 +02:00
Olivier Goffart
539abfc550 Revert "Add a warning if a PopupWindow is in a layout"
This reverts commit 66652cdc1d.

The warning in the gallery are hard to fix because the component inherit
from a layout and there is nowhere to place the popups
2024-06-24 16:38:37 +02:00
Olivier Goffart
66652cdc1d Add a warning if a PopupWindow is in a layout
This is not intuitive since the position of the PopupWindow will not be
handled by the Layout
2024-06-04 13:31:36 +02:00
Aurindam Jana
3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license (#5257)
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00
Aurindam Jana
0cfeec1a31
Update Slint Community License (#4994)
Updated the version from 1.1 to 1.2 
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
2024-04-15 15:18:55 +02:00
Olivier Goffart
1e19e0a754 Rust codegen: fix compile if slint names matches internal names
Fixes #4419
2024-01-24 22:47:58 +01:00
Olivier Goffart
e023335f83 compiler: pre-inline layout info for known builtin types
This makes the layout code a bit bigger in size as the inlined version
is constructing struct from constant, but let the slint compiler "see"
though more code and allow to optimize away many layout related properties

Before this change

cargo run -p slint-compiler -- examples/printerdemo_mcu/ui/printerdemo.slint -f rust | rustfmt | wc
  38873   83654 1925830
cargo run -p slint-compiler -- examples/gallery/gallery.slint -f rust | rustfmt | wc
  103817  224874 5316553

After the this change

cargo run -p slint-compiler -- examples/printerdemo_mcu/ui/printerdemo.slint -f rust | rustfmt | wc
  38643   84506 1925846
cargo run -p slint-compiler -- examples/gallery/gallery.slint -f rust | rustfmt | wc
 103210  224427 5291034
2023-10-12 12:55:00 +02:00
Olivier Goffart
762c21890c Compiler: be more granular for checking for explicit layout constraint
Layout code generates a lot of code and it may be beneficial not to
generate constraints if there is no constraints in that direction

Before the change:

cargo run -p slint-compiler -- examples/printerdemo_mcu/ui/printerdemo.slint -f rust | rustfmt | wc
  40014   86643 2010535
cargo run -p slint-compiler -- examples/gallery/gallery.slint -f rust | rustfmt | wc
  105715  229009 5434115

After this change:

cargo run -p slint-compiler -- examples/printerdemo_mcu/ui/printerdemo.slint -f rust | rustfmt | wc
  38873   83654 1925830
cargo run -p slint-compiler -- examples/gallery/gallery.slint -f rust | rustfmt | wc
  103817  224874 5316553

No measurable changes in compilation time.
2023-10-12 12:55:00 +02:00
Guiguiprim
05cdf88871
Add spacing-horizontal and spacing-vertical to layout (#3532) 2023-09-28 13:49:28 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Olivier Goffart
03bed94072 Fix default geometry of items with inject_element_as_repeated_element
Fixes #3027
2023-06-30 17:35:29 +02:00
Tobias Hunger
e02c360000 Clippy polish 2023-06-28 14:22:30 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Amirhossein Akhlaghpour
3a4f3c61d5
Add @rust-attr on scturct (#2785)
Fixes: #2660
2023-06-05 16:29:55 +02:00
Simon Hausmann
629c7ed80e Remove undocumented and dysfunctional PathLayout
This type is poorly implemented and not documented. Let's remove it for now.
It shall remain available in the git history in the event of a resurrection.
2023-01-21 13:10:19 +01:00
Olivier Goffart
5fbf68a647 Compiler: use the empty type more often instead of the Rectangle
We have that type now, so it should be used when we don't really need a
rectangle
2023-01-10 22:23:53 +01:00
Olivier Goffart
28ae8f7bc4 Refactoring: split ElementType away from the types used as property type
These are two different concept, and it is confusing to keep them in the
same enum

We want to support component without any base element, and Void is
already used for global component, so do this refactoring before
2022-10-26 14:50:44 +02:00
Olivier Goffart
c1f4f4e96b Start working on input/output properties 2022-10-20 08:02:26 +02:00
Olivier Goffart
ca5151de11 C++: implement Window::on_close_requested 2022-03-17 14:49:12 +01:00
Tobias Hunger
4230ac2572
Update copyright information to reflect name change
Also run resue over the codebase and fix complaints from that tool.
2022-02-09 10:27:47 +01:00
Tobias Hunger
de4e195280
Rename internal crates and add a README.md to them
The README.md contains the warning that used to be in lib.rs.

Add README.md files to all internal crates

... pointing to the official public crate to use instead.

Rename internal crates

fixup: README files

fixup rename
2022-02-07 13:12:48 +01:00
Simon Hausmann
ad0c020aa4 Rename the sixtyfps-corelib crate 2022-02-01 18:04:30 +01:00
Tobias Hunger
e6b24bceec [reorg]: Set up and populate the internal directory
Move "internal" crates into the `internal` directory. This first batch
includes most of sixtyfps_runtime but leaves the rendering backends
alone for now.

pre-commit applied some cleanups to the moved files:
 - Consistent newline at end of file policy
 - trimming trailing whitespace
 - Formatting Cargo.toml files.
2022-01-31 16:00:50 +01:00
Renamed from sixtyfps_compiler/layout.rs (Browse further)