Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Experiment: Use Smol to reduce heap allocations
Two different scenarios were measured for the tour example:
Three different scenarios were measured for the 10k rows example:
Usability (as a user):
SmolString is invisible to the user in the
viewdue to impl Into being used and the experience is better than before. In update however the usage is slightly worse when getting a target's id and storing it because you have to call .into().Results (Summary):
Tour Measurements
10k Rows Measurements
How to Measure:
https://github.com/neoeinstein/stats_alloc
Clone down craft with the smol changes in one directory and then clone it down without the changes in another directory and then for each directory: save the following to a
patchfile andgit applythe patch file at the root:Results:
10k rows (WITHOUT Smol):
STARTING FRAME:
Per-frame Allocations: Stats {
allocations: 2051,
deallocations: 1207,
reallocations: 493,
bytes_allocated: 570760,
bytes_deallocated: 339710,
bytes_reallocated: 121657,
}
N FRAMES LATER:
Per-frame Allocations: Stats {
allocations: 1338,
deallocations: 1336,
reallocations: 206,
bytes_allocated: 392832,
bytes_deallocated: 392272,
bytes_reallocated: 71448,
}
10K ROWS CLICKED AND SHOWING:
Per-frame Allocations: Stats {
allocations: 751489,
deallocations: 751487,
reallocations: 60762,
bytes_allocated: 345547457,
bytes_deallocated: 345546897,
bytes_reallocated: 119599883,
}
10k rows (WITH Smol):
STARTING FRAME:
Per-frame Allocations: Stats {
allocations: 2022,
deallocations: 1206,
reallocations: 493,
bytes_allocated: 570357,
bytes_deallocated: 339618,
bytes_reallocated: 121657,
}
N FRAMES LATER:
Per-frame Allocations: Stats {
allocations: 1309,
deallocations: 1307,
reallocations: 206,
bytes_allocated: 392429,
bytes_deallocated: 391869,
bytes_reallocated: 71448,
}
10K ROWS CLICKED AND SHOWING:
Per-frame Allocations: Stats {
allocations: 661651,
deallocations: 661649,
reallocations: 60762,
bytes_allocated: 344849956,
bytes_deallocated: 344849396,
bytes_reallocated: 119599663,
}
Tour (WITHOUT Smol):
STARTING FRAME:
Per-frame Allocations: Stats {
allocations: 2991,
deallocations: 1715,
reallocations: 963,
bytes_allocated: 1182586,
bytes_deallocated: 707643,
bytes_reallocated: 407916,
}
N FRAMES LATER:
Per-frame Allocations: Stats {
allocations: 1903,
deallocations: 1901,
reallocations: 484,
bytes_allocated: 818369,
bytes_deallocated: 817809,
bytes_reallocated: 325752,
}
Tour (WITH Smol):
STARTING FRAME:
Per-frame Allocations: Stats {
allocations: 2935,
deallocations: 1714,
reallocations: 963,
bytes_allocated: 1181426,
bytes_deallocated: 707560,
bytes_reallocated: 407916,
}
N FRAMES LATER:
Per-frame Allocations: Stats {
allocations: 1848,
deallocations: 1846,
reallocations: 484,
bytes_allocated: 817833,
bytes_deallocated: 817273,
bytes_reallocated: 325752,
}