管道的境界
摘要:
一直在想:如何在 Hadoop.MapReduce 中,插入一个 C 写的 HashFunction,既要高效,又要接口简洁。通过命令行实现调用显然是不行的。刚刚终于想出了:使用管道!一个非常简单的程序,从stdin读入,写到stdout。多简单!至于效率,管道嘛,本质上就是异步的,自然是buffered&asynchronous 模式。hash 程序#include int hash(const char* key){ int h = 234234; for (; *key; ++key) h = h << 3 ^ *key; return h;}int main(in. 阅读全文
posted @ 2009-07-28 20:15 能发波 阅读(88) 评论(0) 推荐(0)