1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-26 20:28:49 +08:00
otto/Makefile
Robert Krimen c55510cb36 Inline context initialization & improve _object.value
* Context setup is now done via _newContext.
* _newContext is a function that resides in inline.go. _newContext is very flat,
resulting in almost no function calls (a 180 from the earlier status quo).
* inline.go is a Go source file that is built by Perl (via inline).
* Lots of crufty functions removed (along with all of their TODO & FIXME).
* In addition, before, the underlying value of _object.value was a pointer to
something. This made for extra work, since the type of _object.value is interface{},
which is already something of a pointer. Now, the underlying value of _object.value
in Function, Date, RegExp, ..., is a struct value.
* type_function.go was streamlined, removing superfluous struct fields and methods.
* There is now less "digging" to get to the actual value of a function, which is important
when makings lots of calls.

Before (without inline):

    PASS
    BenchmarkNew        2000           1067871 ns/op
    ok      github.com/robertkrimen/otto    3.336s
    PASS
    BenchmarkNew        2000           1077644 ns/op
    ok      github.com/robertkrimen/otto    3.367s

After (with inline):

    PASS
    BenchmarkNew       10000            364418 ns/op
    ok      github.com/robertkrimen/otto    4.616s
    PASS
    BenchmarkNew       10000            307241 ns/op
    ok      github.com/robertkrimen/otto    4.051s

This (partially) fixes #22
2013-06-09 18:28:18 -07:00

61 lines
1.2 KiB
Makefile

.PHONY: assets todo fixme otto run test-all release test-synopsis test262
.PHONY: test test-race test-check test-all
.PHONY: underscore
TEST := -v --run
TEST := .
CHECK_GO := GOROOT= GOPATH=$(PWD)/.test/check/:$(GOPATH) $(HOME)/go/release/bin/go
CHECK_OTTO := $(PWD)/.test/check/src/github.com/robertkrimen/otto
test: inline.go
go test -i
go test $(TEST)
assets:
mkdir -p .assets
for file in underscore/test/*.js; do tr "\`" "_" < $$file > .assets/`basename $$file`; done
todo:
ack -l TODO *.go
fixme:
ack -l FIXME *.go
otto:
$(MAKE) -C otto
run:
go run -a ./otto/main.go ./otto.js
test-all: inline.go
go test -i
go test
release: test-check test-race test-all test-synopsis
for package in . underscore registry; do (cd $$package && godocdown --signature > README.markdown); done
test-race:
go test -race -i
go test -race
test-check:
@mkdir -p $(CHECK_OTTO)
@find . -name \*.go ! -path ./.\* -maxdepth 2 | rsync -a --files-from - ./ $(CHECK_OTTO)/
$(CHECK_GO) version
$(CHECK_GO) test -i
$(CHECK_GO) test
test-synopsis: .test otto
$(MAKE) -C .test/synopsis 1>/dev/null
test262: .test
$(MAKE) -C .test/test262 test
underscore:
$(MAKE) -C $@
inline.go: inline
./$< > $@