Commit Graph
2284 Commits
Author SHA1 Message Date
Sergio Pedri ee3e9581bb Added new constructors for Ref<T> and ReadOnlyRef<T> 2020-10-08 22:57:35 +02:00
Michael Hawker MSFT (XAML Llama) 541a13addc Merge branch 'master' into feature/array-extensions-deprecation 2020-10-08 13:49:22 -07:00
Michael Hawker MSFT (XAML Llama) 495299321d Merge pull request #3378 from Sergio0694/optimization/movsxd-removal
Codegen improvements (removed unnecessary movsxd ops)
2020-10-08 13:17:29 -07:00
Sergio Pedri 88bc66be05 Added StringPool info in package description 2020-10-08 11:51:23 +02:00
Sergio Pedri eba2644782 Merge branch 'master' into optimization/movsxd-removal 2020-10-08 11:49:14 +02:00
Sergio Pedri 2c3736343e Fixed ObservableValidator.HasErrors unit test 2020-10-08 01:24:26 +02:00
Sergio Pedri b734dd264b Enabled notification for ObservableValidator.HasErrors 2020-10-08 00:24:03 +02:00
Sergio Pedri e5812bcf85 Fixed another missing property change notification 2020-10-08 00:02:59 +02:00
Sergio Pedri a3c1f6e683 Fixed unit test, added missing notification 2020-10-08 00:01:46 +02:00
msftbot[bot] 91bc478c9b Mutable and subclassable version of ObservableGroup (#3526)
## Fixes #3519
<!-- Add the relevant issue number after the "#" mentioned above (for ex: Fixes #1234) which will automatically close the issue once the PR is merged. -->

<!-- Add a brief overview here of the feature/bug & fix. -->
Removes two restrictions from `ObservableGroup` to make it usable in more situations. In my case, I wanted to be able to rename the groups (for this I needed a mutable key), and I wanted to add properties on the group level (I needed to unseal it)
- Removes the immutable restriction on the `Key` property and makes the `Key` property observable.
- Removes the `sealed` keyword from `ObservableGroup`

## PR Type
What kind of change does this PR introduce?
<!-- Please uncomment one or more that apply to this PR. -->

<!-- - Bugfix -->
- Feature
<!-- - Code style update (formatting) -->
<!-- - Refactoring (no functional changes, no api changes) -->
<!-- - Build or CI related changes -->
<!-- - Documentation content changes -->
<!-- - Sample app changes -->
<!-- - Other... Please describe: -->


## What is the current behavior?
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
`ObservableGroup` has an immutable `Key` property
`ObservableGroup` is not inheritable


## What is the new behavior?
<!-- Describe how was this issue resolved or changed? -->
`ObservableGroup` has a mutable `Key` property
`ObservableGroup` is inheritable

## PR Checklist

Please check if your PR fulfills the following requirements:

- [ ] Tested code with current [supported SDKs](../readme.md#supported)
- [x] Pull Request has been submitted to the documentation repository [instructions](..\contributing.md#docs). Link: https://github.com/MicrosoftDocs/WindowsCommunityToolkitDocs/pull/394
- [x] Sample in sample app has been added / updated (for bug fixes / features) --> _no update needed_
    - [x] Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/windows-toolkit/WindowsCommunityToolkit-design-assets) --> _not applicable_
- [x] Tests for the changes have been added (for bug fixes / features) (if applicable) --> _not applicable_
- [x] Header has been added to all new source files (run *build/UpdateHeaders.bat*) --> _not applicable_
- [ ] Contains **NO** breaking changes

<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. 
     Please note that breaking changes are likely to be rejected. -->


## Other information
2020-10-07 13:14:08 +00:00
hansmbakker 4a16d32626 code styling and perf improvement 2020-10-07 14:34:09 +02:00
Hans BakkerandSergio Pedri c14c5dbe2f Code style suggestion
Co-authored-by: Sergio Pedri <sergio0694@live.com>
2020-10-07 09:48:57 +02:00
Hans BakkerandSergio Pedri 7a4ad709fa Code style suggestion
Co-authored-by: Sergio Pedri <sergio0694@live.com>
2020-10-07 09:48:48 +02:00
Hans BakkerandSergio Pedri b5a3bcbe72 Prevent unnecessary OnPropertyChanged
Co-authored-by: Sergio Pedri <sergio0694@live.com>
2020-10-07 09:48:31 +02:00
Sergio Pedri 3451e4027e Added comment to explain the (IntPtr)(void*)(uint) casts 2020-10-07 01:29:09 +02:00
Sergio Pedri f27fcfa299 Added cached args to async relay commands 2020-10-07 01:12:31 +02:00
Sergio Pedri a381191e35 Added notification to AsyncRelayCommand.CanBeCanceled 2020-10-07 01:07:11 +02:00
Sergio Pedri de1c6e1e82 Added new ObservableObject.OnProperty... overloads 2020-10-07 00:55:34 +02:00
hansmbakker 94794bff3a Mutable and subclassable version of ObservableGroup 2020-10-06 22:32:30 +02:00
Sergio Pedri 31c995264b Code refactoring to remove duplicate API 2020-10-06 19:12:52 +02:00
Sergio Pedri bc33155b33 Merge branch 'master' into bugfix/pool-writer-allocations 2020-10-06 19:06:36 +02:00
Michael Hawker MSFT (XAML Llama) 25be5c2cb4 Merge pull request #3380 from Sergio0694/feature/string-pool
StringPool class (ArrayPool<T>-like to cache strings)
2020-10-06 09:52:02 -07:00
Michael Hawker MSFT (XAML Llama) 2444c48e0a Merge branch 'master' into feature/string-pool 2020-10-06 09:51:52 -07:00
Michael Hawker MSFT (XAML Llama) 843c366afa Merge pull request #3505 from Sergio0694/tweak/mvvm-docs
Leftover ObservableObject XML docs fix, minor tweaks
2020-10-06 09:51:15 -07:00
Michael Hawker MSFT (XAML Llama) 3326e8df82 Merge branch 'master' into tweak/mvvm-docs 2020-10-06 09:51:04 -07:00
Michael Hawker MSFT (XAML Llama) 1e4310ab0b Merge pull request #3513 from Sergio0694/refactoring/bounds-checks
Removed unsafe indexing from StrongReferenceMessenger
2020-10-06 09:49:51 -07:00
Michael Hawker MSFT (XAML Llama) 052bc08a3e Merge branch 'master' into feature/string-pool 2020-10-06 09:03:38 -07:00
Sergio Pedri 0c3eee6ce8 Merge branch 'master' into feature/memory-cast 2020-10-06 17:16:37 +02:00
Sergio Pedri a14c69e699 Merge branch 'master' into refactoring/bounds-checks 2020-10-06 16:39:16 +02:00
Sergio Pedri 6dce7301bc Merge branch 'master' into feature/ibuffer-writer-stream2 2020-10-06 16:35:04 +02:00
msftbot[bot] f2969ebb29 Performance improvement in MemoryStream (#3477)
## PR type:
What kind of change does this PR introduce?
<!-- Please uncomment one or more that apply to this PR. -->

- Performance improvement
<!-- - Bugfix -->
<!-- - Feature -->
<!-- - Code style update (formatting) -->
<!-- - Refactoring (no functional changes, no api changes) -->
<!-- - Build or CI related changes -->
<!-- - Documentation content changes -->
<!-- - Sample app changes -->
<!-- - Other... Please describe: -->


## What is the current behavior?
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
The `MemoryStream` type wraps a `Memory<byte>` instance, so every time a read/write operation needs to be performed, it will need to use `Memory<T>.Span`, which is relatively expensive to invoke, as it needs to handle multiple possible sources of data. We can use generic types and the value delegate trick (constrained generic struct + interface) to optimize this away.

## What is the new behavior?
<!-- Describe how was this issue resolved or changed? -->
We now use a `MemoryStream<TSource>` type (which is internal anyway) and have a bunch of `IMemorySource` types specifically supporting `byte[]` and `MemoryManager<byte>` sources with additional optimizations wherever possible. Also, just using this already removes all the overhead of dynamically creating a `Span<T>` from the wrapped `Memory<T>` instance.

Here's a benchmark I put together to show the before/after:

![image](https://user-images.githubusercontent.com/10199417/93274471-be7c0d00-f7ba-11ea-9672-0a24b08908cf.png)

The benchmark consists of writing 1024 times a 1024 bytes buffer to a target `Stream` instance.
The new `MemoryStream<TSource>` version is almost 25% faster just thanks to this change 🚀

## PR Checklist

Please check if your PR fulfills the following requirements:

- [X] Tested code with current [supported SDKs](../readme.md#supported)
- [ ] ~~Pull Request has been submitted to the documentation repository [instructions](..\contributing.md#docs).~~
- [ ] ~~Sample in sample app has been added / updated (for bug fixes / features)~~
    - [ ] ~~Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/windows-toolkit/WindowsCommunityToolkit-design-assets)~~
- [X] Tests for the changes have been added (for bug fixes / features) (if applicable)
- [X] Header has been added to all new source files (run *build/UpdateHeaders.bat*)
- [X] Contains **NO** breaking changes
2020-10-06 14:33:35 +00:00
Sergio Pedri 5ab9968933 Suppressed GC finalize in MemoryOwner<T>.Slice 2020-10-06 16:03:40 +02:00
Michael Hawker MSFT (XAML Llama) b586d50da2 Merge branch 'master' into tweak/mvvm-docs 2020-10-06 06:59:53 -07:00
Michael Hawker MSFT (XAML Llama) e77edb3e42 Merge branch 'master' into refactoring/bounds-checks 2020-10-06 06:58:28 -07:00
Michael Hawker MSFT (XAML Llama) 08f7536c7b Merge branch 'master' into performance/generic-memory-stream 2020-10-06 06:55:55 -07:00
Sergio Pedri 29949bf642 Minor code tweaks 2020-10-06 15:16:39 +02:00
Sergio Pedri 368111012d Removed callvirt-s in BufferWriterStream and AsStream cast 2020-10-06 13:41:57 +02:00
msftbot[bot] 188b906ee7 Shameful rename of [IsNullOr]WhiteSpace Guard APIs (#3515)
## Overview
Some `Guard` APIs were incorrectly using the wrong capitalization for the `WhiteSpace` part, not following the same structure of the actual APIs in the BCL (eg. `string.IsNullOrWhiteSpace`). This PR deprecates them and adds new APIs with the right name.

...I'm sorry 😅

<!-- Add a brief overview here of the feature/bug & fix. -->

## PR Type
What kind of change does this PR introduce?
<!-- Please uncomment one or more that apply to this PR. -->

- API rename
- API deprecation

## PR Checklist

Please check if your PR fulfills the following requirements:

- [X] Tested code with current [supported SDKs](../readme.md#supported)
- [ ] ~~Pull Request has been submitted to the documentation repository [instructions](..\contributing.md#docs). Link: <!-- docs PR link -->~~
- [ ] ~~Sample in sample app has been added / updated (for bug fixes / features)~~
    - [ ] ~~Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/windows-toolkit/WindowsCommunityToolkit-design-assets)~~
- [ ] ~~Tests for the changes have been added (for bug fixes / features) (if applicable)~~
- [ ] ~~Header has been added to all new source files (run *build/UpdateHeaders.bat*)~~
- [X] Contains **NO** breaking changes
2020-10-06 10:42:35 +00:00
Sergio Pedri b738cfd3af Merge branch 'master' into rename/guard-apis 2020-10-06 12:12:12 +02:00
Sergio Pedri 8b5ed6edca Fixed a bug in IBufferWriterStream.WriteByte 2020-10-05 23:00:54 +02:00
Sergio Pedri 045a6a94e8 Added buffer request unit tests 2020-10-05 22:17:32 +02:00
Sergio Pedri 0389a8ef9e Fixed ArrayPoolBufferWriter<T> repeated allocations 2020-10-05 22:02:45 +02:00
Sergio Pedri bda2772426 Merge branch 'master' into feature/string-pool 2020-10-05 20:04:13 +02:00
Sergio Pedri 83f0672886 Fixed a build error in a unit test 2020-10-05 17:58:51 +02:00
Sergio Pedri fa8446fe92 Added unit tests for IBufferWriterStream 2020-10-05 17:56:42 +02:00
Sergio Pedri 7774fb0ad8 Added IBufferWriter<byte>.AsStream extension 2020-10-05 17:30:44 +02:00
Sergio Pedri 95c82d52de Added IBufferWriterStream type 2020-10-05 17:26:23 +02:00
Sergio Pedri f23573827b Added unit tests for StringMemoryManager<TTo> 2020-10-05 11:40:42 +02:00
Sergio Pedri 6403a848f7 Merge branch 'master' into feature/memory-cast 2020-10-05 10:31:38 +02:00
Sergio Pedri 1678529930 Added support for casting Memory<char> from string 2020-10-05 02:06:00 +02:00