Chromium Weekly 2


1 Change

1.1 PSA: PrefJSON files are no longer pretty-printed, becoming 30% smaller.

这个特性是有争议的。对开发者来说,可读性下降,开始你可以通过以下2个方法查看,不久又给去掉了......参照实现,很容易加回来:)

a.If you like these files to be pretty-printed for development, youcan use the new commandline switch "--pretty-print-prefs".

b.chrome://local-state/

JSON文件本来就很小了,看似的30%到底有多大提升,还有待商榷,他们也在等待测试数据来支撑这条是否真的被采纳。

1.2 C++11Feature Proposal: Delegated constructor

FYI, I ran into an MSVC bug wherethe compiler silently generates broken code when delegated constructors are used in a diamond virtualinheritance pattern. Apparently the bug hasbeen fixed, but it's still there in MSVC 2013 Update 4. For your sanity, Isuggest avoiding delegated constructors in complex inheritancechains for now.

这个特性被允许了,但是在继承关系复杂的时候,可能存在BUG,还是慎用为好。

 

2 Design

2.1 [blink-dev]Memory team

Blink存在4个Allocator,Oilpan、PartitionAlloc、tcmalloc、system allocator,分别应对不同的场景,是否多线程、是否可以GC(垃圾回收)。现在他们终于不能忍了,在干完Oilpan这一票之后,决定进行整理,根据GCed和non-GCed,将来BlinkAllocator只包含Oilpan和more optimized PartitionAlloc2个了。

目标是“Develop the best memory allocator in Blink that is fast,secure and space-efficient”

Fast: 60FPS GC, small allocation overhead, good memory locality

Secure: Nouse-after-frees

Space-efficient: Nomemory leaks, no OOM, small footprint

3 Tips

3.1 目前UTF8ToUTF16和 ACSIIToUTF16大家貌似是在混用的,UTF8ToUTF16 支持中英文,ACSIIToUTF16只支持英文。

如果是硬编码,确定不包含中文可以使用ASCIIToUTF16,不需要UTF8ToUTF16。ASCIIToUTF16的性能好于UTF8ToUTF16很多。

 

Example:

base::RemoveChars(title,base::ASCIIToUTF16("\n"), &title);

 

以下2个其实可以换用ASCIIToUTF16

 base::FilePathwinsta_path(
     base::GetNativeLibraryName(base::UTF8ToUTF16("winsta")));

bool apk_file =path.MatchesExtension(base::UTF8ToUTF16(".apk"));

3.2 Now HeapVector(in Oilpan) is 4 times faster than Vector (in PartitionAllloc)for the following (very micro) benchmark. I plan to apply the same optimizationto ParititonAlloc after shipping Oilpan.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值