Skip to content

Commit

Permalink
Improve Binary Xml (XmlDictionaryWriter) performance (#71478)
Browse files Browse the repository at this point in the history
* Improve perf of XmlBinaryWriter using Unsafe

* Use ReverseEndianness to simplify writes

* Use span in a few places

* Add back old comparison, but only write float as int if it saves space

* Use span in array writing to reduce bounds checks

* Extract all unsafe code to shared method

* Fix nodetype type

* Avoid pinning and unsafe when writing arrays

* add back CheckArray

* Fix Assert condition

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>

* Fix review comments

* use new span ctor

* add tests

* Add tests for very long arrays

* Fixx overload resolution for WriteText method

* Just copy guid arrays on LittleEndian platforms

* Add testversion of XmlBinaryNodeType with hardcoded values to use same appoach as in reader PR

* call corrreect version of getbuffer

* Update src/libraries/System.Runtime.Serialization.Xml/tests/ReflectionOnly/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.csproj

* fix merge conflict

* Fix merge conflicts.

* Restored Big-Endian functionality. Ugly though.

* Cleaned up arrays.

* Remove leftover using in tests.

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Steve Molloy <smolloy@microsoft.com>
  • Loading branch information
3 people committed Apr 1, 2023
1 parent 9a8cc5e commit 390c2d5
Show file tree
Hide file tree
Showing 2 changed files with 221 additions and 412 deletions.
Loading

0 comments on commit 390c2d5

Please sign in to comment.