Skip to content

Commit d534507

Browse files
committed
de-optimization to fix revaluation
1 parent 8e1283e commit d534507

5 files changed

Lines changed: 124 additions & 140 deletions

File tree

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ lint:
3636

3737
test:
3838
go test -cover ./...
39+
go test -benchmem -bench=.
3940

4041
.PHONY: all configure help build run lint test
4142

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,31 +56,35 @@ Evaluate `(2) + (2) == (4)`
5656
5757
```diff
5858
$ go test -bench=. -benchmem -benchtime=4s
59-
goos: windows
59+
goos: darwin
6060
goarch: amd64
6161
pkg: github.com/bhmj/xpression
62-
Benchmark_ModifiedNumericLiteral_WithParsing-4 1252026 3753 ns/op 1144 B/op 24 allocs/op
63-
Benchmark_ModifiedNumericLiteral_WithoutParsing-4 32295195 158 ns/op 0 B/op 0 allocs/op
62+
cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
63+
Benchmark_ModifiedNumericLiteral_WithParsing-16 2714204 1853 ns/op 1272 B/op 26 allocs/op
64+
Benchmark_ModifiedNumericLiteral_WithoutParsing-16 31129712 143.9 ns/op 128 B/op 2 allocs/op
6465
PASS
65-
ok github.com/bhmj/xpression 16.605
66+
ok github.com/bhmj/xpression 12.363s
6667
```
6768

6869
The same expression evaluated with [github.com/Knetic/govaluate](https://github.com/Knetic/govaluate) :
6970

7071
```diff
7172
$ go test -bench='LiteralModifiers' -benchmem -benchtime=4s
72-
goos: windows
73+
goos: darwin
7374
goarch: amd64
7475
pkg: github.com/Knetic/govaluate
75-
BenchmarkEvaluationLiteralModifiers_WithParsing-4 559497 8499 ns/op 2272 B/op 49 allocs/op
76-
BenchmarkEvaluationLiteralModifiers-4 10908465 403 ns/op 8 B/op 1 allocs/op
76+
cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
77+
BenchmarkEvaluationLiteralModifiers_WithParsing-16 1000000 4019 ns/op 2208 B/op 43 allocs/op
78+
BenchmarkEvaluationLiteralModifiers-16 30173640 147.2 ns/op 8 B/op 1 allocs/op
7779
PASS
78-
ok github.com/Knetic/govaluate 12.603s
80+
ok github.com/Knetic/govaluate 9.810s
7981
```
8082

8183

8284
## Changelog
8385

86+
**0.7.x** (2021-11-11) -- WIP
87+
**0.7.0** (2021-11-10) -- project renamed to `xpression`
8488
**0.6.0** (2021-11-05) -- a remainder operator `%` added. Benchmarks added. Some optimization done.
8589
**0.5.0** (2021-11-04) -- Tests added. Multiple bugs fixed.
8690
**0.4.0** (2021-11-02) -- Expression evaluation.

0 commit comments

Comments
 (0)