2010/06/18


今じゃぁgcc4が一般的なので、状況変わったかな?と思ったのでWindowsで再度試してみた。
Big Sky :: シャア専用memcpy

試してみた memcpy 最適化 - id:kazuhookuのメモ置き場バイト単位でコピーするアホなコードの方が、勝手にベクトル化される分、gcc 内蔵のヤツより最大3倍高速なんだってwwwx64じ...

http://mattn.kaoriya.net/software/gcc/20080617134829.htm
前回は効果が無かったけど、今回は --------------------------------------------------------------------------
gcc (GCC) 4.4.0
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--------------------------------------------------------------------------

# gcc -O3 -ftree-vectorize -msse2 test.c

adhock memcpy: 1.625031
normal memcpy: 3.734447

# gcc -O3 -ftree-vectorize -ftree-vectorizer-verbose=5 -mmmx -msse3 test.c

adhock memcpy: 1.609581
normal memcpy: 3.750480

# gcc test.c

adhock memcpy: 79.642154
normal memcpy: 4.968845

確かに3倍近いスコアが出てる。もうmemcpyとかinlineでいいんでね?
Posted at by




golangタグが既におかしいですが...
// ; hello world on win32 writen in asm.
// ; compile: 8a helloworld.s
// ; link   : 8l -o helloworld.exe helloworld.8
// ; run    : helloworld.exe
// ; 
// ; if you get the following compile error,
// ;   maybe, namespace separator was broken by copy-and-paste.
// ; open this file with text editor as utf-8 encoding, and fix following...
// ;
// ;   main!main
// ;   main!init
// ;   runtime!printstring
// ;
// ; ! should be code point 183 in unicode.

// ; main.main
TEXT    main·main+0(SB),$16-0
LEAL    gstring+0(SB),SI
LEAL    (SP),DI
CLD     ,
MOVSL   ,
MOVSL   ,
CALL    ,runtime·printstring+0(SB)
RET

// ; main.init
TEXT    main·init+0(SB),$4-0
RET

// ; data for native
GLOBL   string+0(SB),$14
DATA    string+0(SB)/8,$"hello, w"
DATA    string+8(SB)/7,$"orld!\n\z"

// ; data for gostring
GLOBL   gstring+0(SB),$8
DATA    gstring+0(SB)/4,$string+0(SB)
DATA    gstring+4(SB)/4,$13
END     ,
goではplan9形式のアセンブリで書けば8a(6a)でコンパイルでき、8l(6l)でリンク出来るので、上のソースをコンパイルすると見事に「hello, world!」と表示される。plan9のアセンブリってアライメントが必要なのね...。あと文字列リソースはgostring用と分けて書かないとlengthが違っちゃうみたい。

途中にある変な文字「·」はutf-8で183のコードポイントです。
gist: 434256 - GitHub

hello world on win32 writen in asm.

http://gist.github.com/434256
Posted at by




Go言語のWindows版はまだnetやhttpのパッケージが機能しないため、Windows自身で実行出来ないですが、LinuxからWindowsに通知する事は出来るかと思います。(えっそんな人いない?

mattn's go-gntp at master - GitHub

GNTP for golang. http://www.growlforwindows.com/gfw/help/gntp.aspx

http://github.com/mattn/go-gntp
使い方は極力簡単にしました。 client := gntp.NewClient();
client.Register();
client.Notify("ぐろーる!", "こんにちわ!");
こんな感じ。いまはWindowsでは使えないのでSetServer()メソッドでGrowl For Windowsが動いているPCを指定する事になりますね。

ところで...golang-nutsというMLでこんな会話見つけた。
> i saw a tweet that there has been a success of running godoc under
> windows. Does it mean you can use packages net and http in windows? If
> yes, how can I go about it.

It's not ready yet, but I think all the necessary pieces
will be in the next release.
そのツィートがこれ。
Twitter / Andrew: A #golang developer just s ...

go_nuts go_nuts: A #golang developer just sent me a screenshot of godoc running under Windows. Getting excitingly close to having stable Windows support!

http://twitter.com/go_nuts/status/15832858455
次のリリースあたりでWindowsからもnetやhttpパッケージが使えるって事でいいんかな?
ちなみに最近は、Windows版を定期的にリリースしてくれてる人がいるので、試してみたい方はいかがでしょうか。
Posted at by