1. 24 Oct, 2018 1 commit
    • Kirill Smelkov's avatar
      go: Don't allow leaked goroutines to prevent program to exit · 69cef96e
      Kirill Smelkov authored
      This is the Go behaviour, as demonstratd by the following program:
      
      ---- 8< ----
      package main
      
      import (
      	"fmt"
      	"time"
      )
      
      func work(w int) {
      	for i := 0; ; i++ {
      		fmt.Printf("w%d: %d\n", w, i)
      		time.Sleep(1*time.Second)
      	}
      }
      
      func main() {
      	for i := 0; i < 100; i++ {
      		go work(i)
      	}
      
      	time.Sleep(3*time.Second)
      	println("main: exit")
      }
      ---- 8< ----
      69cef96e
  2. 04 Jul, 2018 2 commits
    • Kirill Smelkov's avatar
      pygolang v0.0.0.dev4 · f2905909
      Kirill Smelkov authored
      f2905909
    • Kirill Smelkov's avatar
      py.bench: New command to benchmark python code similarly to `go test -bench` · 9bf03d9c
      Kirill Smelkov authored
      + corresponding bits in golang.testing package.
      
      py.bench description follows:
      
      """
      py.bench, similarly to py.test, discovers bench_* functions and Bench* classes
      and then runs each discovered benchmark via golang.testing.benchmark. Similarly
      to `go test -bench`, benchmarking results are printed in Go benchmark format.
      
      For example, running py.bench on the following code::
      
          def bench_add(b):
              x, y = 1, 2
              for i in xrange(b.N):
                  x + y
      
      gives something like::
      
          $ py.bench --count=3 x.py
          ...
          pymod: bench_add.py
          Benchmarkadd    50000000        0.020 µs/op
          Benchmarkadd    50000000        0.020 µs/op
          Benchmarkadd    50000000        0.020 µs/op
      """
      
      The implementation is based on t/py.bench from Wendelin.core - see
      following commits for its history:
      
      lab.nexedi.com/nexedi/wendelin.core/commit/51f252d4
      lab.nexedi.com/nexedi/wendelin.core/commit/074ce24d
      lab.nexedi.com/nexedi/wendelin.core/commit/ed13c3f9
      lab.nexedi.com/nexedi/wendelin.core/commit/fc08766d
      lab.nexedi.com/nexedi/wendelin.core/commit/5a1ed45a
      lab.nexedi.com/nexedi/wendelin.core/commit/bcab1246
      9bf03d9c
  3. 02 Jul, 2018 4 commits
  4. 20 Jun, 2018 2 commits
    • Kirill Smelkov's avatar
      golang/x/perf/benchlib: New module to load & work with data in Go benchmark format · 812e7ed7
      Kirill Smelkov authored
      Go benchmark format is described here:
      
      	https://github.com/golang/proposal/blob/master/design/14313-benchmark-format.md
      
      Additionally we support extension to that format:
      
      	- a line starting with `*** neotest:` denotes start of neotest extension block.
      	  The block consists of labels describing e.g. hardware and software on a node.
      	  The block ends with a blank line.
      	  Labels in the block are not added to benchmarking lines from main stream.
      	  The block itself should not contain benchmark lines.
      
      and upon processing benchmark units are normalized to common base,
      similarly to
      
      	golang.org/cl/82955
      	golang.org/cl/82956
      	golang.org/cl/82957
      
      Orignally implemented here:
      
      	kirr/neo@502d9477
      	kirr/neo@a9b10a45
      	kirr/neo@f5fec740
      	kirr/neo@916782b6
      812e7ed7
    • Kirill Smelkov's avatar
      Turn pygopath into full pygolang · afa46cf5
      Kirill Smelkov authored
      Not only we can import modules by full path, but now we can also spawn
      threads/coroutines and exchange data in between them with the same
      primitives and semantic as in Go.
      
      The bulk of new functionality is copied from here:
      
      	kirr/go123@9e1aa6ab
      
      Original commit description follows:
      
      """
      golang: New _Python_ package to provide Go-like features to Python language
      - `go` spawns lightweight thread.
      - `chan` and `select` provide channels with Go semantic.
      - `method` allows to define methods separate from class.
      - `gimport` allows to import python modules by full path in a Go workspace.
      
      The focus of first draft was on usage interface and on correctness, not speed.
      In particular select should be fully working.
      
      If there is a chance I will maybe try to followup with gevent-based
      implementation in the future.
      Hide whitespace changes
      """
      afa46cf5
  5. 21 May, 2018 2 commits
    • Kirill Smelkov's avatar
      pygopath: Initial draft · 9c61f254
      Kirill Smelkov authored
      Module gopath provides way to import python modules by full path in a Go workspace.
      
      For example
      
          lonet = gopath.gimport('lab.nexedi.com/kirr/go123/xnet/lonet')
      
      will import either
      
          lab.nexedi.com/kirr/go123/xnet/lonet.py, or
          lab.nexedi.com/kirr/go123/xnet/lonet/__init__.py
      
      located somewhere under $GOPATH.
      9c61f254
    • Kirill Smelkov's avatar
      Start of pygopath.git · 6d47012e
      Kirill Smelkov authored
      A simple project to allow python imports to be done by full path in a Go
      workspace.
      6d47012e