Erlang-China

erlang 中文社区

ErlyBird 0.16.0 Released - An Erlang IDE based on NetBeans


I’m pleased to announce ErlyBird 0.16.0, an Erlang IDE based on NetBeans. This is an important feature release in size of 25M. If you have latest NetBeans nightly build installed, you can also install ErlyBird modules via update center.

 

CHANGELOG:

 

    * Project metadata file is changed, please see Notes

    * Instant rename (put caret on variable or function name, press CTRL+R, when rename finished, press ENTER)

    * Go-To-Declaration to macros that are defined included header files

    * Fixed: Go-To-Declaration to -inlcudelib won’t work again after this include header file was opened in editor once

    * Fixed: syntax broken for packaged import attribute

    * Fixed: syntax broken for wild attribute

    * Completion suggestion will not search other projects

    * Track GSF changes, reindex performance was improved a lot; Can live with other GSF based language support now (Ruby, Groovy etc)

 

Java JRE 5.0+ is required.

 

To download, please go to: http://sourceforge.net/project/showfiles.php?group_id=192439

 

To install:

 

   1. Unzip erlybird-bin-0.16.0-ide.zip to somewhere.

   2. Make sure ‘erl.exe’ or ‘erl’ is under your environment path

   3. For Windows user, execute ‘bin/erlybird.exe’. For *nix user, ‘bin/erlybird’.

   4. Check/set your OTP path. From [Tools]->[Options], click on ‘Erlang’, then ‘Erlang Installation’ tab, fill in the full path of your ‘erl.exe’ or ‘erl’ file. For instance: “C:/erl/bin/erl.exe”

   5. The default -Xmx option for jvm is set to 256M, ErlyBird now works good with less memory, such as -Xmx128M. If you want to increase/decrease it, please open the config file that is located at etc/erlybird.conf, set -J-Xmx of ‘default_options’.

 

When run ErlyBird first time, the OTP libs will be indexed. The indexing time varies from 10 to 30 minutes deponding on your computer.

 

Notes:

 

   1. Since project metadata format is changed, to open old ErlyBird created project, you should modify project.xml which is located at your project folder: nbproject/project.xml, change line:

 

      <type>org.netbeans.modules.languages.erlang.project</type>

 

      to:

 

      <type>org.netbeans.modules.erlang.project</type>

 

   2. If you have previous version ErlyBird installed, you should delete the old cache files which are located at:

          * *nix: “${HOME}/.erlybird/dev”

          * mac os x: “${HOME}/Library/Application Support/erlybird/dev”

          * windows: “C:\Documents and Settings\yourusername\.erlybird\dev” or some where

 

The status of ErlyBird is still Alpha, feedbacks and bug reports are welcome. 


Wide Finder - Erlang实现


Tim的WideFinder习题让多核和并行编程实践在一个简单的问题上有了多种语言作一次比较的机会,所以参与者甚多,我觉得也是很有意义的一件事。今天有点时间,作一个小总结。

目前排行榜上列第一、第二、第三的分别是OCaml+JoCaml,Erlang和Python。C/C++的版本理论上应该可以有很好的结果,但现在还没出来,这反倒说明用C/C++来完成这么一个简单的并行任务并不是很顺畅。

就Erlang的实现而言,基本上是一些象我这样的初学者慢慢摸索(Anders和Steve也都是初学者),加上专家们在一些关键地方的适时指点的过程。

现在看来,几个重要的转折在:
1、min_heap_size的设置对Binary性能的影响非常重要,这涉及到Heap的初始分配、GC的性能。好在探询合适的+h参数比较方便,在命令行加+h Size就可以了;
2、遍历Binary时尽量只移动指针,如无必要,就不要分解出子binary。这对Binary的操作性能也是至关重要,因为分解出的binary要在globle heap中分配并被GC回收,这样是要耗时间的。

解决上述问题后,Erlanger们(包括Anders, Pichi和我)立刻不需要再担心binary的性能,而且已经可以轻易击败ruby了。但要和最快的python实现(wf-6.py)相比,还要解决一个问题:搜索算法。python对定长字符串的搜索是2006年时由Fredrik Lundh写了一个Boyer-Moore的算法并加入到Python 2.5中的,因此Fredrik Lundh在实现他的WideFinder时很自然就用了它。Steve注意到了这一点,用Erlang实现了一个类似的,这样Erlang和Python的的比较才算公平。

于是Anders的wfinder8能在T5120上跑到4.42秒,与Fredrik Lundh的wf-6的4.38秒期鼓相当。

但Fredrik Lundh的wf-6.py和Fernandez的JoCaml版本都是利用操作系统的process来跑并行的。Erlang则是用操作系统的thread来调度自己的轻量process,因此Anders就再写了一个wfinder7_2,干脆跑n个node,每个node是一个操作系统的process,利用Node之间的通讯来合并结果,这个实现能跑到3.54秒,超过了Python,只比JoCaml的1.76秒慢。

还应该提到的是,JoCaml和Python都使用到了Memory Mapping,相当于把整个log文件读到和映射到内存中,因为Tim的那台T5120有8个G的内存,所以这个处理不会带来频繁的swap,不过我本人不喜欢这种方式。

我写程序比较喜欢简洁和直接了当,所以我的实现注重的是在简洁、可读和性能之间的平衡,最后的实现是tbray9a.erl,大约115行,最快是5.26秒。

与Python,JoCaml相比,我喜欢Erlang的地方在于,Erlang对并行和并发的支持在语法和机制上是一致的,而且性能也毫不逊色。Python在进程间通讯时使用了管道、JoCaml也基本上是这样,这也无所谓,但遇到并发情景时,Python和JoCaml就难受了,是用操作系统的Process呢还是用Thread?都不是好的方案。而对Erlang而言,并发和并行的处理机制是一致的,不管在是在自己的轻量processes层次,还是在Node层次,甚至,还有一个层次,就是,它同时还是分布的。


ErlyBird 0.15.1 Released - An Erlang IDE based on NetBeans


I’m pleased to announce ErlyBird 0.15.1, an Erlang IDE based on NetBeans.
This is a performance improvement release. This release will only provide all-in-one IDE package,
which is in size of 18.3M.

CHANGELOG:

  • Performance improvement.
  • Integrated with NetBeans’ Common Scripting Framework. Thanks Tor.
  • Fix a bug related to occurrences mark on built-in functions.
  • Fix bug of wrong formatting multiple-lines string.
  • Supports “-module(x.y.z)” syntax.
  • Various bugs fixes.

Java JRE 5.0+ is required.

To download, please go to:
http://sourceforge.net/project/showfiles.php?group_id=192439

To install:

  1. Unzip erlybird-bin-0.15.1-ide.zip to somewhere.
  2. Make sure ‘erl.exe’ or ‘erl’ is under your environment path
  3. For Windows user, execute ‘bin/erlybird.exe’. For *nix user, ‘bin/erlybird’.
  4. Check/set your OTP path. From [Tools]->[Options], click on ‘Erlang’, then ‘Erlang Installation’ tab, fill in the full path of your ‘erl.exe’ or ‘erl’ file. For instance: “C:/erl/bin/erl.exe”
  5. The default -Xmx option for jvm is set to 256M, ErlyBird now works good with less memory, such as -Xmx128M. If you want to increase/decrease it, please open the config file that is located at etc/erlybird.conf, set -J-Xmx of ‘default_options’.

When run ErlyBird first time, the OTP libs will be indexed. The indexing time varies from 10 to 30 minutes deponding on your computer.

Notice:
If you have previous version of ErlyBird 0.12.0+ installed, you can keep your old cache files, otherwise, please delete the old cache files which are located at:

  • *nix: “${HOME}/.erlybird/dev”
  • mac os x: “${HOME}/Library/Application Support/erlybird/dev”
  • windows: “C:\Documents and Settings\yourusername\.erlybird\dev” or some where

The status of ErlyBird is still Alpha, feedbacks and bug reports are welcome.