同樣的 warshall 演算法,同樣的節點數1000,只做迴圈及assign 不作 if 判斷 ,使用的指令如下
g++ -O2 -march=pentium3 test.cpp -o ./cpp
gcj --main=Test Test.java -O2 -march=pentium3 -o ./java
使用的機器是 Pentium3 1G 256k catch
記憶體 256 MB
平台是 Gentoo Linux kernel 2.6.10
執行時間如下
native code
real 2m12.760s
user 2m12.489s
sys 0m0.105s
c++
real 0m2.028s
user 0m2.022s
sys 0m0.003s
java bytecode be compiled by gcj run with blackdown-jdk-1.4.2.01
real 0m38.511s
user 0m38.415s
sys 0m0.055s
java bytecode be compiled by blackdown and run with balckdown-jdk
real 0m38.513s
user 0m38.425s
sys 0m0.050s
java bytecode be compiled by gcj with -lgij run with gij
real 9m31.586s
user 9m31.211s
sys 0m0.261s
星期二, 4月 26, 2005
星期一, 4月 25, 2005
Linux 上的 openoffice 1.9 測試版
不知道為什麼,在 gentoo 上的 openoffice 1.9.m91 跟在 windows 2000 上的 openoffice 1.9.m91 比起來感覺在 linux 上 openoffice 不是很穩定.
不知道是否是環境的關係還是因為 windows 上的測試者比較多所致
我只好跳回去用 openoffice 1.1.4 , 希望等到 6 , 7 月 openoffice 2.0 正式出來後
這些不穩定的問題可以解決
不知道是否是環境的關係還是因為 windows 上的測試者比較多所致
我只好跳回去用 openoffice 1.1.4 , 希望等到 6 , 7 月 openoffice 2.0 正式出來後
這些不穩定的問題可以解決
JAVA 的隱式 promotion
今天才注意到 C 與 JAVA 的不同點之一
在 C 中 , 兩個原生運算元在進行運算時 , 兩個運算元會被轉成可以容納較大資訊的型別
但是在 JAVA 中像是 short , byte , char 這三個型別在運算時則是一律先晉升成 int 才進行運算
這一篇留做備忘
在 C 中 , 兩個原生運算元在進行運算時 , 兩個運算元會被轉成可以容納較大資訊的型別
但是在 JAVA 中像是 short , byte , char 這三個型別在運算時則是一律先晉升成 int 才進行運算
這一篇留做備忘
C++ 的使用者自訂型別轉換
之前從來沒有想過 C++ 有這個功能.
在 class 下定義一個 member function 格式如下
operator type(){}
在有需要的時候 compiler 會找到這個 member function 進行適當的轉型動作
例如最常見的 while( std::cin >> input) 就是 compiler 動的手腳
他會去 call input 的 operator void*() 進行轉型
但是比較詭異的是像底下程式碼最後的結果是 int
為什麼不是 bool ??
#include
class Test{
public:
operator int(){
return 0;
}
operator bool(){
return true;
}
};
int main(){
Test test;
if( test == false ){
std::cout << "int\n"; }else{ std::cout << "bool\n"; } return 0; }
在 class 下定義一個 member function 格式如下
operator type(){}
在有需要的時候 compiler 會找到這個 member function 進行適當的轉型動作
例如最常見的 while( std::cin >> input) 就是 compiler 動的手腳
他會去 call input 的 operator void*() 進行轉型
但是比較詭異的是像底下程式碼最後的結果是 int
為什麼不是 bool ??
#include
class Test{
public:
operator int(){
return 0;
}
operator bool(){
return true;
}
};
int main(){
Test test;
if( test == false ){
std::cout << "int\n"; }else{ std::cout << "bool\n"; } return 0; }
FreeBSD 的 /libexec/ld-elf.so.1
今天把別人的機器給搞爆了
在 FreeBSD 5.3 release 下的 /usr/ports 下 make update 時出現
/usr/libexec/ld-elf.so.1 找不到
於是我白痴的下了
mv /libexec/ld-elf.so.1 /usr/libexec/ld-elf.so.1
結果所有的程式都不能 run 了@@
以後什麼都東西要用別處的東西來替代切記要用 cp 而不能用 mv
在 FreeBSD 5.3 release 下的 /usr/ports 下 make update 時出現
/usr/libexec/ld-elf.so.1 找不到
於是我白痴的下了
mv /libexec/ld-elf.so.1 /usr/libexec/ld-elf.so.1
結果所有的程式都不能 run 了@@
以後什麼都東西要用別處的東西來替代切記要用 cp 而不能用 mv
星期日, 4月 24, 2005
訂閱:
文章 (Atom)