Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

77 seconds to run hello world #388

Open
ShakataGaNai opened this issue Dec 8, 2017 · 3 comments
Open

77 seconds to run hello world #388

ShakataGaNai opened this issue Dec 8, 2017 · 3 comments

Comments

@ShakataGaNai
Copy link

  • checked out from git today: 3ec8795
  • go version go1.9.2 darwin/amd64
  • Mac on 10.26.6 Sierra
  • Darwin SM0948 16.7.0 Darwin Kernel Version 16.7.0: Mon Nov 13 21:56:25 PST 2017; root:xnu-3789.72.11~1/RELEASE_X86_64 x86_64 i386 MacBookPro14,2 Darwin

image

77 seconds to compile the hello world, this was the second time I ran it - so if there is cacheing/downloading to do - it should have already done it. I think the first time was even slower than this, but I didn't time that.

@vbarbaresi
Copy link

vbarbaresi commented Jan 4, 2018

I can reproduce on OSX Sierra as well.
For some reason, on the second make run, a lot of targets remain:

$ echo "print 'hello, world'" | make run -n
mkdir -p build/src/__python__/__go__/grumpy
build/bin/pkgc grumpy > build/src/__python__/__go__/grumpy/module.go
mkdir -p build/pkg/darwin_amd64/__python__/__go__
go install __python__/__go__/grumpy
mkdir -p build/pkg/darwin_amd64/__python__
go tool compile -o build/pkg/darwin_amd64/__python__/__builtin__.a -p __python__/__builtin__ -complete -I build/pkg/darwin_amd64 -pack build/src/__python__/__builtin__/module.go
mkdir -p build/pkg/darwin_amd64/__python__
go tool compile -o build/pkg/darwin_amd64/__python__/sys.a -p __python__/sys -complete -I build/pkg/darwin_amd64 -pack build/src/__python__/sys/module.go
mkdir -p build/pkg/darwin_amd64/__python__
go tool compile -o build/pkg/darwin_amd64/__python__/cStringIO.a -p __python__/cStringIO -complete -I build/pkg/darwin_amd64 -pack build/src/__python__/cStringIO/module.go
mkdir -p build/pkg/darwin_amd64/__python__
go tool compile -o build/pkg/darwin_amd64/__python__/exceptions.a -p __python__/exceptions -complete -I build/pkg/darwin_amd64 -pack build/src/__python__/exceptions/module.go
mkdir -p build/pkg/darwin_amd64/__python__
go tool compile -o build/pkg/darwin_amd64/__python__/thread.a -p __python__/thread -complete -I build/pkg/darwin_amd64 -pack build/src/__python__/thread/module.go
mkdir -p build/pkg/darwin_amd64/__python__
go tool compile -o build/pkg/darwin_amd64/__python__/_collections.a -p __python__/_collections -complete -I build/pkg/darwin_amd64 -pack build/src/__python__/_collections/module.go
mkdir -p build/pkg/darwin_amd64/__python__
go tool compile -o build/pkg/darwin_amd64/__python__/itertools.a -p __python__/itertools -complete -I build/pkg/darwin_amd64 -pack build/src/__python__/itertools/module.go
mkdir -p build/pkg/darwin_amd64/__python__
go tool compile -o build/pkg/darwin_amd64/__python__/os.a -p __python__/os -complete -I build/pkg/darwin_amd64 -pack build/src/__python__/os/module.go
mkdir -p build/pkg/darwin_amd64/__python__
go tool compile -o build/pkg/darwin_amd64/__python__/linecache.a -p __python__/linecache -complete -I build/pkg/darwin_amd64 -pack build/src/__python__/linecache/module.go
mkdir -p build/pkg/darwin_amd64/__python__
[...]

Although the .a files already exist, they will be rebuilt, not sure why

From the third run it stops compiling and works fast

@alanjds
Copy link
Contributor

alanjds commented Feb 23, 2018

Just to inform: I am working on this issue.

$ echo "print 'hello, world'" | time grumpy run
hello, world
        0.90 real         0.85 user         0.22 sys
$ uname -a
Darwin mymachine.local 16.0.0 Darwin Kernel Version 16.0.0: Mon Aug 29 17:56:20 PDT 2016; root:xnu-3789.1.32~3/RELEASE_X86_64 x86_64

Machine: MacBookPro12,1

Will followup later. Yet a lot of stuff to optimize on the importing routines

alanjds added a commit to alanjds/grumpy-tools that referenced this issue Feb 23, 2018
…hind

This can possible fix issue google/grumpy#388: 77 seconds to run hello world
@alanjds
Copy link
Contributor

alanjds commented May 17, 2018

Just published a "grumpy-runtime" package on PyPI. It installs the grumpy CLI tool and compiles the runtime on your machine. Took 3 min. on my notebook.

Then you can run:

$ echo "print 'hello'" | grumpy run

And it takes ~2 seconds on my machine.

Published yesterday and is very beta right now, but opens world to cache compiled stuff on __pycache__ folders.

Please provide feedback if you can.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@alanjds @ShakataGaNai @vbarbaresi and others