aboutsummaryrefslogtreecommitdiff
path: root/expr.go
AgeCommit message (Collapse)Author
2015-07-10use github.com/golang/glogFumitoshi Ukai
2015-07-09use sync.Pool for evalBuffer and wordBufferFumitoshi Ukai
2015-07-08fix unmatched_paren2.mkFumitoshi Ukai
2015-07-07fix equal_in_target.mkFumitoshi Ukai
2015-07-07fix err_unterminated_var.mkFumitoshi Ukai
2015-07-07fix err_unterminated_func.mkFumitoshi Ukai
2015-07-07introduce evalWriterFumitoshi Ukai
merge ssvWriter into buffer
2015-07-07refactor parserFumitoshi Ukai
fix backslash_in_rule_command.mk
2015-07-03fix unmatched_paren.mkFumitoshi Ukai
2015-06-30fix TODO in value.mkFumitoshi Ukai
2015-06-26fix panic based error reportingFumitoshi Ukai
2015-06-25unexport Func and ExprFumitoshi Ukai
2015-06-25unexport serialize/deserializeFumitoshi Ukai
2015-06-25fix TestParaFumitoshi Ukai
unexport ValueType*
2015-06-25go gettable for github.com/google/katiFumitoshi Ukai
2015-06-24add -shell-date flag to specify time for $(shell date)Fumitoshi Ukai
--shell-date=ref uses go reference time. useful to check parsed data with golden data.
2015-06-19add param.mkFumitoshi Ukai
no need to assign/restore call parameter
2015-06-18remove convT2I from appendStrFumitoshi Ukai
2015-06-18reduce runtime.convT2I -> runtime.newobject -> runtime.mallocgcFumitoshi Ukai
conversion from value to interface is more expensive than conversion from pointer to interface. package main import "testing" type I interface { String() string } type val struct { s string } func (v val) String() string { return v.s } type ptr struct { s string } func (p *ptr) String() string { return p.s } func BenchmarkT2IForValue(b *testing.B) { var intf I for i := 0; i < b.N; i++ { intf = val{"abc"} } _ = intf } func BenchmarkT2IForPtr(b *testing.B) { var intf I for i := 0; i < b.N; i++ { intf = &ptr{"abc"} } _ = intf } % go test -bench . a_test.go testing: warning: no tests to run PASS BenchmarkT2IForValue 20000000 90.9 ns/op BenchmarkT2IForPtr 20000000 76.8 ns/op ok command-line-arguments 3.539s
2015-06-18parseExpr less allocationFumitoshi Ukai
2015-06-15add findleaves supportFumitoshi Ukai
2015-06-15trace event: also emit findcache init eventFumitoshi Ukai
2015-06-11refactor sh builtinsFumitoshi Ukai
add -use_shell_builtins flag to disable the feature (when some builtin is broken)
2015-06-11add -kati_trace_event=<json filename>Fumitoshi Ukai
if this option is given, it outputs trace json file for chrome://tracing for makefile include traces.
2015-06-10Add LICENSE and licence headersShinichiro Hamaji
2015-06-08fix -kati_eval_stats to dump stats for func callFumitoshi Ukai
2015-06-08fix go lint (except comment on exported fields, error message with punct)Fumitoshi Ukai
ast.go:70:1: comment on exported type MaybeRuleAST should be of the form "MaybeRuleAST ..." (with optional leading article) eval.go:241:1: comment on exported method Evaluator.EvaluateVar should be of the form "EvaluateVar ..." eval.go:14:2: don't use ALL_CAPS in Go names; use CamelCase eval.go:15:2: don't use ALL_CAPS in Go names; use CamelCase eval.go:16:2: don't use ALL_CAPS in Go names; use CamelCase eval.go:431:2: don't use underscores in Go names; var makefile_list should be makefileList main.go:29:2: var loadJson should be loadJSON main.go:30:2: var saveJson should be saveJSON ninja.go:19:2: struct field ruleId should be ruleID para.go:15:9: if block ends with a return statement, so drop this else and outdent its block para_test.go:21:2: don't use underscores in Go names; var num_tasks should be numTasks parser.go:713:1: error should be the last type when returning multiple items serialize.go:20:2: don't use ALL_CAPS in Go names; use CamelCase serialize.go:21:2: don't use ALL_CAPS in Go names; use CamelCase serialize.go:22:2: don't use ALL_CAPS in Go names; use CamelCase serialize.go:23:2: don't use ALL_CAPS in Go names; use CamelCase serialize.go:24:2: don't use ALL_CAPS in Go names; use CamelCase serialize.go:25:2: don't use ALL_CAPS in Go names; use CamelCase serialize.go:26:2: don't use ALL_CAPS in Go names; use CamelCase serialize.go:27:2: don't use ALL_CAPS in Go names; use CamelCase serialize.go:28:2: don't use ALL_CAPS in Go names; use CamelCase serialize.go:29:2: don't use ALL_CAPS in Go names; use CamelCase serialize.go:30:2: don't use ALL_CAPS in Go names; use CamelCase serialize.go:31:2: don't use ALL_CAPS in Go names; use CamelCase serialize.go:32:2: don't use ALL_CAPS in Go names; use CamelCase serialize.go:230:6: func DumpDepGraphAsJson should be DumpDepGraphAsJSON serialize.go:553:6: func LoadDepGraphFromJson should be LoadDepGraphFromJSON serialize.go:437:9: if block ends with a return statement, so drop this else and outdent its block var.go:174:1: receiver name should not be an underscore var.go:175:1: receiver name should not be an underscore var.go:176:1: receiver name should not be an underscore var.go:177:1: receiver name should not be an underscore var.go:178:1: receiver name should not be an underscore var.go:180:1: receiver name should not be an underscore var.go:183:1: receiver name should not be an underscore var.go:187:1: receiver name should not be an underscore var.go:191:1: receiver name should not be an underscore
2015-05-15Do not use gob to create unqiue ID for each varsShinichiro Hamaji
Now serialization is 5 times faster (41 secs => 8 secs).
2015-05-08define buffer to hold args in addition to bytes.BufferFumitoshi Ukai
2015-05-08don't reuse too large bufferFumitoshi Ukai
too large buffer may cause pressure on memory/gc, so reuse buffer that cap < 1024 (as fmt pacakge does)
2015-05-07use sync.Pool for temporal bytes.Buffer.Fumitoshi Ukai
remove ev.Value and ev.Values before: scanblock: 8.22s (14.83%) runtime.MScan_Sweep 4.99s(9.00%) after: scanblock: 7.42s (12.95%) runtime.MScan_Sweep 4.57s(7.98%)
2015-04-28Re-format codeShinichiro Hamaji
2015-04-28Make it possible to serialize varsShinichiro Hamaji
2015-04-19minor performance tuningFumitoshi Ukai
use []byte instead of bytes.Buffer to reduce heap allocation.
2015-04-19add paramref for fast path for param access (e.g. $1, $(1))Fumitoshi Ukai
still set "1" in Vars, for access like n := 1 v := $($(n)) fix to set $0 to variable name in $(call ) after: % ./run_integration_test.rb android Running make for android... 5.62 secs Running kati for android... 10.89 secs android: OK PASS!
2015-04-18minor performance tuningFumitoshi Ukai
don't call unnecessary bytes.IndexByte before: ukai@ubune.tok ~/src/kati% ./run_integration_test.rb android Running make for android... 5.78 secs Running kati for android... 13.44 secs android: OK PASS! after: % ./run_integration_test.rb android Running make for android... 5.75 secs Running kati for android... 10.97 secs android: OK PASS!
2015-04-18use io.WriteString instead of fmt.FprintFumitoshi Ukai
remove unnecessary []byte string conversion in funcShell.
2015-04-18minor performance tuningFumitoshi Ukai
before: % ./run_integration_test.rb android Running make for android... 5.76 secs Running kati for android... 17.29 secs android: OK PASS! after: % ./run_integration_test.rb android Running make for android... 5.83 secs Running kati for android... 14.55 secs android: OK PASS!
2015-04-16Compactor returns Value, not FuncFumitoshi Ukai
2015-04-16introduce func compactor.Fumitoshi Ukai
$(eval ## comment) will be nop when parsed.
2015-04-16remove trimSpace and inFunc from parseExpr.Fumitoshi Ukai
handled these in parseFunc.
2015-04-16change f.closure.args[0] has "(funcname", or "{funcname".Fumitoshi Ukai
remove f.closure.expr fclosure.String would not be called so often now (except debug logging?), and keeping expr would require lots of memory.
2015-04-15dump stats for eval time.Fumitoshi Ukai
for android dump-products $ cd repo/android $ ../../kati -kati_stats dump-products .. build/core/product_config.mk:235: *** done. func:$(foreach _in,$(2), $(if $(wildcard $(_in)), $(if $($(1).$(_in).seen), $(eval ### "skipping already-imported $(_in)") , $(eval $(1).$(_in).seen := true) $(call _import-node,$(1),$(strip $(_in)),$(3)) ) , $(error $(1): "$(_in)" does not exist) ) ),1556,695.16116ms,1m59.356291639s func:$(if $(wildcard $(_in)), $(if $($(1).$(_in).seen), $(eval ### "skipping already-imported $(_in)") , $(eval $(1).$(_in).seen := true) $(call _import-node,$(1),$(strip $(_in)),$(3)) ) , $(error $(1): "$(_in)" does not exist) ),1492,695.141538ms,1m59.31431654s func:$(if $($(1).$(_in).seen), $(eval ### "skipping already-imported $(_in)") , $(eval $(1).$(_in).seen := true) $(call _import-node,$(1),$(strip $(_in)),$(3))),1492,695.103627ms,1m59.274735972s func:$(call _import-node,$(1),$(strip $(_in)),$(3)),1492,695.059475ms,1m59.211652155s func:$(call _import-nodes-inner,$(1),$($(1).$(2).inherited),$(3)),1492,665.538963ms,1m34.44328975s func:$(call import-products, $(all_product_makefiles)),1,25.242518851s,25.242518851s func:$(call import-nodes,PRODUCTS,$(1),$(_product_var_list)),1,25.242508858s,25.242508858s func:$(if $(foreach _in,$(2), $(eval _node_import_context := _nic.$(1).[[$(_in)]]) $(if $(_include_stack),$(eval $(error ASSERTION FAILED: _include_stack shouldbe empty here: $(_include_stack))),) $(eval _include_stack := ) $(call _import-nodes-inner,$(_node_import_context),$(_in),$(3)) $(call move-var-list,$(_node_import_context).$(_in),$(1).$(_in),$(3)) $(eval _node_import_context :=) $(eval $(1) := $($(1)) $(_in)) $(if $(_include_stack),$(eval $(error ASSERTION FAILED: _include_stack should be empty here: $(_include_stack))),) ) ,),1,25.242492045s,25.242492045s func:$(foreach _in,$(2), $(eval _node_import_context := _nic.$(1).[[$(_in)]]) $(if $(_include_stack),$(eval $(error ASSERTION FAILED: _include_stack should be empty here: $(_include_stack))),) $(eval _include_stack := ) $(call _import-nodes-inner,$(_node_import_context),$(_in),$(3)) $(call move-var-list,$(_node_import_context).$(_in),$(1).$(_in),$(3)) $(eval _node_import_context :=) $(eval $(1) := $($(1)) $(_in)) $(if $(_include_stack),$(eval $(error ASSERTION FAILED: _include_stack should be empty here: $(_include_stack))),) ),1,25.242488741s,25.242488741s func:$(call _import-nodes-inner,$(_node_import_context),$(_in),$(3)),64,695.186876ms,24.959185237s ..
2015-04-13Fix calls in multiple linesShinichiro Hamaji
2015-04-11Remove the use of evalExpr from condition functionsShinichiro Hamaji
2015-04-11rewrite call and foreachFumitoshi Ukai
before: % ./run_integration_test.rb android tar -xzf ../android.tgz Running make for android... 6.05 secs Running kati for android... 64.08 secs android: OK PASS! after: % ./run_integration_test.rb android tar -xzf ../android.tgz Running make for android... 5.76 secs Running kati for android... 41.54 secs android: OK PASS!
2015-04-10preserve func expression to make Func.String() faster.Fumitoshi Ukai
maybe better to revisit it's worth doing. before: % ./run_integration_test.rb android tar -xzf ../android.tgz Running make for android... 5.78 secs Running kati for android... 62.50 secs android: OK PASS! after: % ./run_integration_test.rb android tar -xzf ../android.tgz Running make for android... 5.85 secs Running kati for android... 61.93 secs android: OK PASS!
2015-04-10split expression parser and evaluatorFumitoshi Ukai