Chromium Weekly 2

来源:互联网 发布:淘宝号怎么买到 编辑:程序博客网 时间:2024/05/16 05:11


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
原创粉丝点击