惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

I
Intezer
V
Vulnerabilities – Threatpost
Google Online Security Blog
Google Online Security Blog
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
AWS News Blog
AWS News Blog
G
GRAHAM CLULEY
P
Privacy & Cybersecurity Law Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
N
News | PayPal Newsroom
T
Tenable Blog
Spread Privacy
Spread Privacy
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Secure Thoughts
P
Privacy International News Feed
IT之家
IT之家
Project Zero
Project Zero
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
大猫的无限游戏
大猫的无限游戏
博客园_首页
GbyAI
GbyAI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
量子位
雷峰网
雷峰网
Apple Machine Learning Research
Apple Machine Learning Research
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
Martin Fowler
Martin Fowler
NISL@THU
NISL@THU
I
InfoQ
D
DataBreaches.Net
有赞技术团队
有赞技术团队
K
Kaspersky official blog
Security Latest
Security Latest
The Register - Security
The Register - Security
Hugging Face - Blog
Hugging Face - Blog
S
Security @ Cisco Blogs
P
Proofpoint News Feed
M
MIT News - Artificial intelligence
H
Hackread – Cybersecurity News, Data Breaches, AI and More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
AI
AI
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
N
News and Events Feed by Topic

博客园 - Zhenway

Azure SignalR支持replication啦 Azure SignalR总览 定制json序列化 今天折腾这么一个正则 docfx daylybuild docfx开源啦 docfx组件介绍--MarkdownLite docfx预热中 合并批量请求 一个简单的Linq to TreeNode 在finally中调用一个需要await的方法 当泛型方法推断,扩展方法遇到泛型类型in/out时。。。 4.5你太黑了,不带这么玩TypeForwardedTo的 一个非常简单的反射加速方案 加载时预防并发执行 又发现一个msdn的坑 又发现个.net framework的坑 sql server死锁神器 踩到一个Emit的坑,留个纪念
docfx组件介绍--YamlSerialization
Zhenway · 2016-02-16 · via 博客园 - Zhenway

  在docfx中把元数据以yaml的形式保存,在metadata阶段会序列化数据到yaml文件中,在build阶段又需要从yaml文件反序列化出来。在使用过程中,意外发现yamldotnet在处理大量强类型数据时性能奇差,将yaml反序列化为弱类型后,再序列化为json,再从json反序列化为强类型,这样看起来超级折腾的3步走竟然比yaml直接反序列化为强类型的性能足足提高了3倍。。。无奈之下,我们开始尝试自己写个序列化器,于是就有了Microsoft.DocAsCode.YamlSerialization这个project。不过这个project与yamldotnet有以下不同:

  • 这个project依赖yamldotnet,直接使用yamldotnet的底层的yaml格式的读写
  • 为了优化性能,使用了emit,所以导致下面两个副作用:
    • 只能序列化public的类型和属性,而yamldotnet可以处理non-public的类型和数学
    • 由于emit的特性,在大量数据时性能好,而仅有少量数据时反而性能差
  • 修复了几个序列化反序列化时碰到的问题:
    • 序列化时,将字符串"true",强制序列化为"true",而不是yamldotnet的true
    • 反序列化弱类型时,将true反序列化为boolean类型,而"true"为字符串类型,而yamldotnet均作为字符串类型
    • 正确序列化和反序列化单引号或双引号开头的字符串
  • 增加可扩展属性,也就是json.net里面类似JsonExtensionData
    • 不过为了简化代码的复杂性,不能像json.net那样发现属性为null是自动new一个对象
    • 可以指定可扩展属性的前缀