Try Grumpy.

Somedays ago, I read a news from google. Google developed “Grumpy”, it is an experimental runtime for Go.
Grumpy translates python code into Go programs.
I do not have knowledge about Golang, but it seems interesting.
So, I used grumpy.
Grumpy can get from github.
If user want to use grumpy, install is very easy.

iwatobipen$ git clone
iwatobipen$ grumpy

I made sample snippet.

print( "I started Grumpy!!" )
for i in range( 10 ):
    print( "GO! \n"* i )
for i in range( 20 ):
    if i % 2 == 0:
        print( i )
        print( "hoge" )

Then set environment.

iwatobipen$ make
iwatobipen$ export GOPATH=$PWD/build
iwatobipen$ export PYTHONPATH=$PWD/build/lib/python2.7/site-packages

Then compile the python script and build a binary from it.

iwatobipen$ tools/grumpc > test.go
iwatobipen$ go build test.go

Run test.

iwatobipen$ time python 
I started Grumpy!!
real	0m0.102s
user	0m0.042s
sys	0m0.026s

iwatobipen$ time go run test.go 
I started Grumpy!!
real	0m1.288s
user	0m1.397s
sys	0m0.211s

iwatobipen$ time ./test
I started Grumpy!!
real	0m0.015s
user	0m0.008s
sys	0m0.007s

It works.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s