hadashiA / VYaml

The extra fast, low memory footprint YAML library for C#, focued on .NET and Unity.
MIT License
309 stars 19 forks source link

Yaml pre compiled deserialize improvement #118

Closed rube200 closed 1 month ago

rube200 commented 1 month ago

Hello there, i was messing around with transpilerm and IL, and found out that switch in Deserialize could be improved.

This code: https://github.com/hadashiA/VYaml/blob/aa786ee098dec28f66839c5df2df41e54172e2e9/VYaml.SourceGenerator/Emitter.cs#L425-L426 could be replaced to codeWriter.AppendLine("goto default");

As you can see by this iamge (IL code), it created the same code again and again instead of jumping for default labek image

hadashiA commented 1 month ago

Thanks for pointing this out. I would like to understand the issue clearly - is it a question of increasing the amount of code? My understanding is that it doesn't seem to affect the speed of execution, is my perception correct?

rube200 commented 1 month ago

Yes, this issue should not affect execution speed. This issue just affect compiled file sizes per field

hadashiA commented 1 month ago

Ok, personally I don't think it's that big a deal, give me a pull request and I'll merge it in.

hadashiA commented 1 month ago

Merged #119