Progress on LLVM clang

| Development | #clang | #FreeBSD | #gcc | #llvm

As some of you already know, FreeBSD, along with some other Open Source projects, is moving away from GCC due to GPLv3. From a technology perspective, this also makes sense since the (likely) candidate, BSD-style licensed, LLVM based clang, a C compiler, is making reasonably good progress.

So, what should we expect from LLVM or clang?

Here is a good comparison between GCC and clang. Despite GCC is popular, considerably more mature, and supports more languages (especially C++, which clang’s support is incomplete at this moment), clang provides cleaner AST (Abstract Syntax Tree), much more modularized (if you take a look at GCC’s history, Richard Stallman intentionally made GCC’s code not reusable in other software), provided much more information for optimizer, is much faster and use much less memory, etc.

For FreeBSD, currently, clang can compile its kernel with only very few tweaks.

阅读全文…( 本文约 315 字,阅读大致需要 2 分钟 )

New strlen(3) committed

| Development | #FreeBSD | #strlen

Finally, I got my strlen(3) [1] committed against -HEAD. This is a long story, to put it short, I had proposed assembly version of some string operations at the point of 2005, but these was never committed due to a hard disk failure, and as Bruce pointed out, having the hand optimized assembly code use a different algorithm is not good in general.

Therefore, I have take some time on it and reimplemented the idea in C, resulting in a portable (say, you can use it on any 32-bit or 64-bit processors, and it can be easily extended to 128-bit) version.

So, is it important for *YOU*?

Generally speaking, it should not. Performance sensitive programs should, by all means, avoid C style string operations. Think a 5x better strlen(3) would boost performance of your application since it uses strlen(3) in critical path? Think again!

However, I found it valuable. There is difference in worldstone, where I saw some minor improvements. Micro-benchmark indicates that this version is at most 2x slower when the string is very short, but 5x faster for strings that is at least word-length long.

[1] Note: the version has been further revised to provide better comment and match style(9).

阅读全文…( 本文约 295 字,阅读大致需要 2 分钟 )

Happy Niu (牛) Year!

| Life | #lunar calendar | #new year

Ok so it’s something that happen only once in 12 years - this year, we have the Bull as totem of the lunar year in China, the pronounciation of the Chinese character, “牛” is very similar to English word “new”.

So, happy new year, and happy 牛 year, my friends.

参与评论

今天讲个小故事

| Life | #随笔

忘记在哪里看到的了,应该是小时候看过的某本书。先不要管故事的合理性,我只是想说明一个很简单的道理。

说从前有一个国王,他有两个儿子,这两个儿子总是互相攀比,搞的国王头疼不已。

有一天,国王想出了一个主意。他把两个儿子带到沙漠边上,给了他们一个人一匹马。他对两个儿子说,你们两个穿过这片沙漠,但是今天不要比谁的马快,我要比的是你们谁的马后走出沙漠,后走出沙漠的人就可以得到王位。

两个儿子在沙漠里互相抱怨着父王的这个馊主意。突然,哥哥灵机一动,对弟弟说了几句话。

接着,两个人骑马飞奔而去。

故事讲完了,你知道哥哥的主意是什么吗?

阅读全文…( 本文约 405 字,阅读大致需要 1 分钟 )

প্রাণ

| Shared Chaos | #Life

ভুলবো না আর সহজেতে
সেই প্রাণে মন উঠবে মেতে
মৃত্যু মাঝে ঢাকা আছে
যে অন্তহীন প্রাণ
বজ্রে তোমার বাজে বাঁশি
সেকি সহজ গান
সেই সুরেতে জাগবো আমি
সেই ঝড় যেন সই আনন্দে
চিত্তবীণার তারে
সপ্তসিন্ধু দশ দিগন্ত
নাচাও যে ঝঙ্কারে
বজ্রে তোমার বাজে বাঁশি
সেকি সহজ গান
সেই সুরেতে জাগবো আমি

阅读全文…( 本文约 231 字,阅读大致需要 1 分钟 )

2009硬盘磨损年开始

| Life | #2009

第三块硬盘了……

参与评论

7.1-RELEASE升级流量冲击导致portsnap服务同步受阻

许多老派的 FreeBSD 用户喜欢用源代码方式升级。运行了十多年的基于 cvsup 的同步机制由于有很多镜像支持因此一直没有遇到太大的问题,但是 FreeBSD 6.1 开始引入的 freebsd-update 提供了新的以二进制形式更新系统的方法,最近几年 FreeBSD 内核的许多改进已经使编译自定义的内核不再像以前那样重要了。

阅读全文…( 本文约 193 字,阅读大致需要 1 分钟 )

互联网时代没有隐私

| Security | #Internet | #privacy

之前和 A core 聊过这个问题。整理一下发出来。

这个话说的可能比较绝对,有人说,缺少信任的社会是可悲的—-而我想说的是,现今,被过度滥用的信任则是可怕的。通过各式各样的社交网站,如 FacebookLinkedIn开心网天际网等等(我想有人会提到 豆瓣,但是我个人认为豆瓣算是一个比较另类的社交网站,因为上面的人很少使用真名),很多人之间的联系被轻易地挖掘和利用。

阅读全文…( 本文约 1377 字,阅读大致需要 3 分钟 )

推荐一篇文章《如何找到属于自己的兴趣》

| Life

来自李笑来老师的blog(原来在新东方上过他的GRE课)的《如何找到属于自己的兴趣》。

参与评论

慈禧太后的宣战上谕

| Shared Chaos

洋人欺我太甚,竟至国之将亡。与其苟且图存,贻羞万古,不如大张挞伐,一决雌雄!我大清朝威严宣布:向英吉利国开战!向法兰西国开战!向美利坚国开战!向德意志国开战!向俄罗斯国开战!向意大利国开战!向奥地利国开战!向日本国开战!钦此。

参与评论