Browse Source

Merge branch 'master' of https://github.com/amarsahinovic/FrameworkBenchmarks into amarsahinovic-master

Patrick Falls 12 years ago
parent
commit
848023af04
9 changed files with 82 additions and 0 deletions
  1. 0 0
      beego/.gitkeep
  2. 18 0
      beego/README.md
  3. 0 0
      beego/__init__.py
  4. 11 0
      beego/benchmark_config
  5. 0 0
      beego/bin/.gitkepp
  6. 0 0
      beego/pkg/.gitkeep
  7. 2 0
      beego/setup.bat
  8. 25 0
      beego/setup.py
  9. 26 0
      beego/src/hello/hello.go

+ 0 - 0
beego/.gitkeep


+ 18 - 0
beego/README.md

@@ -0,0 +1,18 @@
+# Beego Benchmarking Test
+
+This is the Beego portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
+
+### JSON Encoding Test
+
+* [Beego JSON output](https://github.com/astaxie/beego/blob/master/docs/en/Quickstart.md#output-json-and-xml)
+
+## Versions
+
+* [Go 1.1](http://golang.org/)
+* [Beego](https://github.com/astaxie/beego/)
+
+## Test URLs
+
+### JSON Encoding Test
+
+    http://localhost:8080/json

+ 0 - 0
beego/__init__.py


+ 11 - 0
beego/benchmark_config

@@ -0,0 +1,11 @@
+{
+  "framework": "beego",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "json_url": "/json",
+      "port": 8080,
+      "sort": 118
+    }
+  }]
+}

+ 0 - 0
beego/bin/.gitkepp


+ 0 - 0
beego/pkg/.gitkeep


+ 2 - 0
beego/setup.bat

@@ -0,0 +1,2 @@
+set GOPATH=C:\FrameworkBenchmarks\beego
+go run src\hello\hello.go

+ 25 - 0
beego/setup.py

@@ -0,0 +1,25 @@
+
+import subprocess
+import sys
+import os
+
+def start(args):
+  if os.name == 'nt':
+    subprocess.call("set GOPATH=C:\\FrameworkBenchmarks\\beego&&go get ./...", shell=True, cwd="beego")
+    subprocess.Popen("setup.bat", shell=True, cwd="beego")
+    return 0
+  subprocess.call("go get ./...", shell=True, cwd="beego")
+  subprocess.Popen("go run src/hello/hello.go".rsplit(" "), cwd="beego")
+  return 0
+def stop():
+  if os.name == 'nt':
+    subprocess.call("taskkill /f /im go.exe > NUL", shell=True)
+    subprocess.call("taskkill /f /im hello.exe > NUL", shell=True)
+    return 0
+  p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
+  out, err = p.communicate()
+  for line in out.splitlines():
+    if 'hello' in line:
+      pid = int(line.split(None, 2)[1])
+      os.kill(pid, 9)
+  return 0

+ 26 - 0
beego/src/hello/hello.go

@@ -0,0 +1,26 @@
+package main
+
+import (
+	"github.com/astaxie/beego"
+	"runtime"
+)
+
+type MessageStruct struct {
+	Message string
+}
+
+type JsonController struct {
+	beego.Controller
+}
+
+func (this *JsonController) Get() {
+	m := MessageStruct{"Hello, world"}
+	this.Data["json"] = &m
+	this.ServeJson()
+}
+
+func main() {
+	runtime.GOMAXPROCS(runtime.NumCPU())
+	beego.Router("/json", &JsonController{})
+	beego.Run()
+}