Commit e0c94f8
Improve XmlDictionaryWriter UTF8 encoding performance (#73336)
* Speed up text encoding
* Update implementation
* Add tests for binary xml strings
* limit counting code to 256 bit vectors
* reword comment
* rename test
* move bytesmax
* Fix bytesMax after moving variable initialization
* use unicode escape value in test
* fix test typo "*" -> "+"
* Update src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlStreamNodeWriter.cs
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Remvoe vectorized code from UnsafeGetUTF8Length
* Fix overfload
* use for loop which seems faster
* remove vector loop
* make sealed encoding to allow devirtualisation
* back some changes
* use uint for UnsafeGetUTF8Chars comparison
* revert more changes
* Fix cutoff based on new measurements
* use BinaryPrimitives.ReverseEndianness as suggested
* Update cutoff from 24 to 32 chars before calling, due to regression for text based DataContractSerializer
* Remove sealed encoding since it only improves XmlConvert
---------
Co-authored-by: Stephen Toub <stoub@microsoft.com>1 parent b54d6ef commit e0c94f8
File tree
2 files changed
+93
-41
lines changed- src/libraries
- System.Private.DataContractSerialization/src/System/Xml
- System.Runtime.Serialization.Xml/tests
2 files changed
+93
-41
lines changedLines changed: 28 additions & 41 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
330 | 332 | | |
331 | 333 | | |
332 | 334 | | |
333 | | - | |
| 335 | + | |
334 | 336 | | |
335 | | - | |
336 | | - | |
| 337 | + | |
337 | 338 | | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
| 339 | + | |
| 340 | + | |
342 | 341 | | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
343 | 348 | | |
344 | 349 | | |
345 | 350 | | |
346 | 351 | | |
347 | 352 | | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
| 353 | + | |
| 354 | + | |
361 | 355 | | |
362 | 356 | | |
363 | 357 | | |
| |||
366 | 360 | | |
367 | 361 | | |
368 | 362 | | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
| 363 | + | |
| 364 | + | |
374 | 365 | | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
375 | 369 | | |
376 | 370 | | |
377 | 371 | | |
378 | 372 | | |
379 | | - | |
| 373 | + | |
380 | 374 | | |
381 | 375 | | |
382 | 376 | | |
383 | 377 | | |
384 | 378 | | |
| 379 | + | |
385 | 380 | | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
399 | 388 | | |
400 | | - | |
401 | | - | |
402 | 389 | | |
403 | 390 | | |
404 | 391 | | |
| |||
Lines changed: 65 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
497 | 562 | | |
498 | 563 | | |
499 | 564 | | |
| |||
0 commit comments