Skip to content

テンプレート文字列の変数に対する書式指定とカルチャー指定対応#240

Merged
finphie merged 101 commits into
mainfrom
202404131430
May 11, 2024
Merged

テンプレート文字列の変数に対する書式指定とカルチャー指定対応#240
finphie merged 101 commits into
mainfrom
202404131430

Conversation

@finphie

@finphie finphie commented May 11, 2024

Copy link
Copy Markdown
Owner

fix #230
fix #231

  • テンプレート文字列の変数に対する書式指定とカルチャー指定対応
  • WriteメソッドにIFormatProviderのオーバーロードを追加
  • 文字列以外(int型など)の定数をIFormatProvider確定時にUTF-8 byte配列として埋め込み
  • 非ソースジェネレーターの変数でも任意の型に対応
  • テスト追加

@finphie

finphie commented May 11, 2024

Copy link
Copy Markdown
Owner Author
Method Job Categories Mean Error Ratio Gen0 Gen1 Allocated
SimpleTextTemplate.Generator No PGO Constant Int 15.44 ns 0.130 ns 1.00 0.0048 - 40 B
(Utf8.TryWrite) No PGO Constant Int 25.90 ns 0.181 ns 1.68 0.0048 - 40 B
(InterpolatedStringHandler) No PGO Constant Int 40.74 ns 0.425 ns 2.64 0.0067 - 56 B
(CompositeFormat) No PGO Constant Int 30.96 ns 0.332 ns 2.01 0.0067 - 56 B
SimpleTextTemplate.Generator PGO Constant Int 12.52 ns 0.189 ns 1.00 0.0048 - 40 B
(Utf8.TryWrite) PGO Constant Int 23.29 ns 0.101 ns 1.86 0.0048 - 40 B
(InterpolatedStringHandler) PGO Constant Int 40.04 ns 0.253 ns 3.20 0.0067 - 56 B
(CompositeFormat) PGO Constant Int 30.04 ns 0.171 ns 2.40 0.0067 - 56 B
SimpleTextTemplate.Generator No PGO Constant String 17.17 ns 0.226 ns 1.00 0.0067 - 56 B
(Utf8.TryWrite) No PGO Constant String 27.42 ns 0.284 ns 1.60 0.0067 - 56 B
(InterpolatedStringHandler) No PGO Constant String 42.62 ns 0.894 ns 2.48 0.0105 - 88 B
(CompositeFormat) No PGO Constant String 43.88 ns 0.926 ns 2.73 0.0105 - 88 B
SimpleTextTemplate.Generator PGO Constant String 13.31 ns 0.179 ns 1.00 0.0067 - 56 B
(Utf8.TryWrite) PGO Constant String 23.42 ns 0.205 ns 1.76 0.0067 - 56 B
(InterpolatedStringHandler) PGO Constant String 39.87 ns 0.268 ns 3.00 0.0105 - 88 B
(CompositeFormat) PGO Constant String 34.57 ns 0.322 ns 2.60 0.0105 - 88 B
SimpleTextTemplate.Generator No PGO Int 23.70 ns 0.209 ns 1.00 0.0057 - 48 B
SimpleTextTemplate No PGO Int 94.27 ns 0.906 ns 3.98 0.0057 - 48 B
Scriban No PGO Int 10,253.11 ns 22.273 ns 432.98 3.7079 0.3510 31027 B
Liquid No PGO Int 8,817.88 ns 35.157 ns 372.28 3.9978 0.4272 33442 B
(Utf8.TryWrite) No PGO Int 21.13 ns 0.188 ns 0.89 0.0057 - 48 B
(InterpolatedStringHandler) No PGO Int 40.69 ns 0.348 ns 1.72 0.0076 - 64 B
(CompositeFormat) No PGO Int 34.64 ns 0.406 ns 1.46 0.0076 - 64 B
SimpleTextTemplate.Generator PGO Int 20.77 ns 0.146 ns 1.00 0.0057 - 48 B
SimpleTextTemplate PGO Int 81.29 ns 0.097 ns 3.91 0.0057 - 48 B
Scriban PGO Int 9,066.34 ns 81.421 ns 436.55 3.6926 0.3357 31027 B
Liquid PGO Int 6,999.40 ns 18.696 ns 337.04 3.9978 0.4425 33442 B
(Utf8.TryWrite) PGO Int 16.55 ns 0.197 ns 0.80 0.0057 - 48 B
(InterpolatedStringHandler) PGO Int 39.82 ns 0.246 ns 1.92 0.0076 - 64 B
(CompositeFormat) PGO Int 30.22 ns 0.240 ns 1.46 0.0076 - 64 B
SimpleTextTemplate.Generator No PGO String 33.18 ns 0.251 ns 1.00 0.0057 - 48 B
SimpleTextTemplate No PGO String 98.29 ns 0.779 ns 2.96 0.0057 - 48 B
Scriban No PGO String 10,377.55 ns 85.221 ns 312.77 3.6926 0.3510 31003 B
Liquid No PGO String 9,327.01 ns 94.859 ns 281.11 3.9825 0.3967 33418 B
(Utf8.TryWrite) No PGO String 25.75 ns 0.162 ns 0.78 0.0057 - 48 B
(InterpolatedStringHandler) No PGO String 38.73 ns 0.347 ns 1.17 0.0086 - 72 B
(CompositeFormat) No PGO String 48.57 ns 0.256 ns 1.46 0.0086 - 72 B
SimpleTextTemplate.Generator PGO String 24.95 ns 0.242 ns 1.00 0.0057 - 48 B
SimpleTextTemplate PGO String 79.17 ns 0.150 ns 3.17 0.0057 - 48 B
Scriban PGO String 8,751.57 ns 39.993 ns 350.74 3.6926 0.3357 31003 B
Liquid PGO String 7,581.99 ns 80.655 ns 303.84 3.9902 0.4044 33418 B
(Utf8.TryWrite) PGO String 22.21 ns 0.120 ns 0.89 0.0057 - 48 B
(InterpolatedStringHandler) PGO String 38.73 ns 0.219 ns 1.55 0.0086 - 72 B
(CompositeFormat) PGO String 39.36 ns 0.432 ns 1.58 0.0086 - 72 B

@finphie
finphie merged commit 73b3312 into main May 11, 2024
@finphie
finphie deleted the 202404131430 branch May 11, 2024 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

文字列以外の定数書き込み最適化 WriteメソッドにIFormatProvider引数付きのオーバーロードを追加

1 participant