Dave Cunningham
2f2f6d664f
Add wasm build
2021-09-09 12:45:53 +01:00
Dave Cunningham
e3c7ddab44
Remove support for go 1.11
2021-09-09 12:45:53 +01:00
Dave Cunningham
c187d5b373
fix bazel rules for formatter ( #563 )
2021-09-08 11:18:01 +01:00
Bruno Silva
dde866ffbb
Add example usage as library in README ( #560 )
...
Add example usage as library in README
2021-08-31 22:34:41 +01:00
Stanisław Barzowski
b00b56c335
Avoid depending on stdlib variable for desugaring.
...
The fix is easy – we just use "$std" which the user cannot access,
because it's not a valid identifier.
2021-08-09 19:25:33 +01:00
Tsuyoshi Hombashi
51daeb3229
Modify jsonnet-lint to accept multiple input files ( #545 )
...
Modify jsonnet-lint to accept multiple input files
2021-07-01 13:10:51 +02:00
Stanisław Barzowski
46d1fceb9c
[Linter] Fix super index type and handle "object or string" indexing correctly.
2021-06-06 21:13:19 +02:00
Lucas Servén Marín
12bd29d164
linter: correct the return type for member
...
This commit corrects return type of the `member` function from the
standard library.
Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2021-05-26 13:52:39 +02:00
Stanisław Barzowski
7373f5b606
Add test output overrides for jsonnetfmt.
2021-05-20 14:23:06 +02:00
Greg Roodt
e6a9581713
Adds std.parseYaml ( #339 )
...
Add support for std.parseYaml.
Co-authored-by: Stanisław Barzowski <stanislaw.barzowski@gmail.com>
2021-05-20 14:16:23 +02:00
Paul Fischer
ece9c5dc94
updated pre-commit config and readme
2021-05-19 16:01:22 +02:00
Harsimran Singh Maan
1b7cbff4cd
Add github actions ci
2021-05-19 16:00:28 +02:00
Stanisław Barzowski
ba5dc76509
Stop depending on nil vs empty slice in a test.
...
It should not make the difference.
2021-05-19 15:11:08 +02:00
Stanisław Barzowski
5899996502
Make go linter happy again.
2021-05-19 15:10:49 +02:00
Yiannis
ce76155e09
Fix strip definition
...
Co-authored-by: Tom Fenech <tomjwfenech@gmail.com>
2021-05-19 13:57:47 +02:00
Yiannis
bead95bfa6
Add linter support for std.strip and friends
2021-05-14 17:01:21 +02:00
Simon Let
415d036e5e
Put AddPlusObject behind an option, rename FixPlusObject
2021-04-29 22:55:07 +02:00
Simon Let
be7a92aa5c
jsonnetfmt: Add plus objects instead of removing them
2021-04-29 22:55:07 +02:00
Stanisław Barzowski
74b3a1b669
[Linter] Support std.member and std.repeat.
2021-03-25 18:35:13 +01:00
Leandro López
eeca44cd27
Allocate resulting slice size instead of dynamically growing it
...
We know for sure how big the resulting slice will be, so instead of
having Go perform checks and reallocations whenever the slice grows
too small by using `append` we calculate the resulting size earlier
and directly index each element into the output slice. This result in
only two allocations all the time, no matter how big the resulting
slice will be. With it also come big performance improvements:
name old time/op new time/op delta
ToOrderedSlice/1_unique_identifiers-8 173ns ±10% 150ns ± 4% -13.16% (p=0.000 n=10+9)
ToOrderedSlice/10_unique_identifiers-8 1.24µs ± 6% 0.51µs ± 5% -58.95% (p=0.000 n=9+9)
ToOrderedSlice/100_unique_identifiers-8 20.4µs ±20% 4.0µs ± 5% -80.25% (p=0.000 n=10+9)
ToOrderedSlice/1000_unique_identifiers-8 253µs ± 9% 40µs ± 5% -84.19% (p=0.000 n=10+10)
ToOrderedSlice/10000_unique_identifiers-8 3.44ms ± 9% 0.37ms ± 5% -89.32% (p=0.000 n=9+9)
ToOrderedSlice/100000_unique_identifiers-8 48.6ms ±13% 3.6ms ± 4% -92.49% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
ToOrderedSlice/1_unique_identifiers-8 40.0B ± 0% 40.0B ± 0% ~ (all equal)
ToOrderedSlice/10_unique_identifiers-8 520B ± 0% 184B ± 0% -64.62% (p=0.000 n=10+10)
ToOrderedSlice/100_unique_identifiers-8 4.10kB ± 0% 1.82kB ± 0% -55.75% (p=0.000 n=10+10)
ToOrderedSlice/1000_unique_identifiers-8 32.8kB ± 0% 16.4kB ± 0% -49.95% (p=0.000 n=10+10)
ToOrderedSlice/10000_unique_identifiers-8 826kB ± 0% 164kB ± 0% -80.16% (p=0.000 n=10+10)
ToOrderedSlice/100000_unique_identifiers-8 9.25MB ± 0% 1.61MB ± 0% -82.64% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
ToOrderedSlice/1_unique_identifiers-8 2.00 ± 0% 2.00 ± 0% ~ (all equal)
ToOrderedSlice/10_unique_identifiers-8 6.00 ± 0% 2.00 ± 0% -66.67% (p=0.000 n=10+10)
ToOrderedSlice/100_unique_identifiers-8 9.00 ± 0% 2.00 ± 0% -77.78% (p=0.000 n=10+10)
ToOrderedSlice/1000_unique_identifiers-8 12.0 ± 0% 2.0 ± 0% -83.33% (p=0.000 n=10+10)
ToOrderedSlice/10000_unique_identifiers-8 21.0 ± 0% 2.0 ± 0% -90.48% (p=0.000 n=10+10)
ToOrderedSlice/100000_unique_identifiers-8 31.0 ± 0% 2.0 ± 0% -93.55% (p=0.000 n=10+10)
For ToSLice we use the same changes except the sort operation. In this
case the results are even more impressive: allocations are stable at
just 1 per operation, regardless of set size, and performance is
orders of magnitude faster:
name old time/op new time/op delta
ToSlice/1_unique_identifiers-8 83.0ns ± 1% 92.4ns ± 0% +11.37% (p=0.000 n=9+8)
ToSlice/10_unique_identifiers-8 295ns ± 4% 749ns ± 3% +154.21% (p=0.000 n=10+10)
ToSlice/100_unique_identifiers-8 2.33µs ± 2% 4.28µs ± 2% +83.62% (p=0.000 n=9+8)
ToSlice/1000_unique_identifiers-8 25.4µs ±10% 34.7µs ± 1% +36.51% (p=0.000 n=10+10)
ToSlice/10000_unique_identifiers-8 215µs ± 2% 543µs ± 1% +152.15% (p=0.000 n=9+10)
ToSlice/100000_unique_identifiers-8 2.05ms ± 2% 7.17ms ± 1% +249.53% (p=0.000 n=9+9)
name old alloc/op new alloc/op delta
ToSlice/1_unique_identifiers-8 16.0B ± 0% 16.0B ± 0% ~ (all equal)
ToSlice/10_unique_identifiers-8 160B ± 0% 496B ± 0% +210.00% (p=0.000 n=10+10)
ToSlice/100_unique_identifiers-8 1.79kB ± 0% 4.08kB ± 0% +127.68% (p=0.000 n=10+10)
ToSlice/1000_unique_identifiers-8 16.4kB ± 0% 32.8kB ± 0% +99.90% (p=0.000 n=10+10)
ToSlice/10000_unique_identifiers-8 164kB ± 0% 826kB ± 0% +404.12% (p=0.000 n=8+10)
ToSlice/100000_unique_identifiers-8 1.61MB ± 0% 9.25MB ± 0% +475.93% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
ToSlice/1_unique_identifiers-8 1.00 ± 0% 1.00 ± 0% ~ (all equal)
ToSlice/10_unique_identifiers-8 1.00 ± 0% 5.00 ± 0% +400.00% (p=0.000 n=10+10)
ToSlice/100_unique_identifiers-8 1.00 ± 0% 8.00 ± 0% +700.00% (p=0.000 n=10+10)
ToSlice/1000_unique_identifiers-8 1.00 ± 0% 11.00 ± 0% +1000.00% (p=0.000 n=10+10)
ToSlice/10000_unique_identifiers-8 1.00 ± 0% 20.00 ± 0% +1900.00% (p=0.000 n=10+10)
ToSlice/100000_unique_identifiers-8 1.00 ± 0% 30.00 ± 0% +2900.00% (p=0.000 n=10+10)
Signed-off-by: Leandro López <leandro.lopez@grafana.com>
2021-03-25 15:44:43 +01:00
Leandro López
067dc391aa
Add IdentifierSet.ToOrderedSlice and ToSlice benchmarks
...
This will be useful later on when implementing the performance
improvements to compare how much we gain.
Signed-off-by: Leandro López <leandro.lopez@grafana.com>
2021-03-25 15:44:43 +01:00
Hanyu Cui
63a452246d
Support different output streams than os.Stderr for std.trace (C API) ( #520 )
...
Support different output streams than os.Stderr for std.trace (C API)
2021-03-21 20:03:01 +01:00
Stanisław Barzowski
7d81091149
Linter README – replace unicode asterisks
...
I think they were an artifact of copying from a LaTeX-generated PDF.
2021-02-21 20:59:24 +01:00
Lucas Servén Marín
9b6cbef4ca
testdata: std.manifestJsonEx text cases more types
...
This commit adds test cases for more types to ensure that
std.manifestJsonEx continues to work with all types that may be given
as the `value` parameter.
Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2021-02-15 14:44:08 +01:00
Lucas Servén Marín
9bba8deca0
testdata: add manifestJsonEx array test case
...
This commit adds a test case to prevent regressions in
std.manifestJsonEx accepting arrays as values.
Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2021-02-15 14:44:08 +01:00
Lucas Servén Marín
5d0f3fb5ed
builtins.go: fix builtinManifestJSONEx regression
...
This commit fixes a regression in std.manifestJsonEx that caused the
standard library function to error when the given value was an array.
Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2021-02-15 14:44:08 +01:00
Hanyu Cui
f742f2463e
Allow setting a different output stream than os.Stderr for std.trace ( #514 )
...
Allow std.trace output to other streams
2021-02-09 14:44:23 +01:00
Kumar Gaurav
4a3144a417
pre-commit hook to format jsonnet files
2021-02-06 14:47:43 +01:00
gotwarlost
6d6c293079
allow initialization of external and TLA code variables from an AST node.
...
This allows configuration of a VM with an external code variable that has been pre-parsed into an AST node.
This allows a caller to pre-parse a large object into a node and re-use that for multiple VMs. The cost
of converting the object to an ast.Node is incurred only once by the caller as opposed to having this
eagerly incurred (whether or not the object is used) before the eval.
2021-02-04 12:05:09 +01:00
Krishnan Anantheswaran
8a3fcc0302
Allow reset of ext and TLA vars for VM reuse ( #509 )
...
Allow reset of ext and TLA vars for VM reuse
Currently ext and TLA vars can be set but not reset. This makes
re-using VMs that have different variables impossible.
Add VM methods to be able to reset ext and TLA vars
2021-02-03 22:55:13 +01:00
Hanyu Cui
cd59751527
Distinguish go-jsonnet from cpp-jsonnet in version message ( #497 )
...
Distinguish the Go implementation in the version message
2021-01-13 20:46:15 +01:00
Stanisław Barzowski
31d71aaccd
Add missing linter metadata for stdlib.
...
Fixes #483 .
2021-01-01 19:17:40 +01:00
Stanisław Barzowski
6140a2f75a
Better stacktrace for manifestation, +: and object assertions.
...
Fixes #282
2021-01-01 19:17:27 +01:00
Hanyu Cui
7d3bda3911
Add std. manifestJsonMinified ( #492 )
...
Pick up std changes in cpp and update builtinManifestJSONEx
2020-12-31 11:20:31 +01:00
Stanisław Barzowski
4beab6633f
Prevent keeping files open for too long.
...
Fixes #485 .
2020-12-21 01:14:30 +01:00
Lucendio
fd65a61e87
Fix builds filter ro re-enable darwin builds
...
I was not able to find any evidences of darwin builds being disabled intentionally. Considering
the [documentation](https://goreleaser.com/customization/build/ ) I suspect that this was by
mistake. Currently, each list item is applied individually (OR). If I'm wrong, please discard this
PR and share your reasoning.
2020-12-12 23:49:31 +01:00
Kohei Suzuki
35acb29ff8
Add format APIs to C bindings
2020-11-26 19:23:49 +01:00
Kohei Suzuki
57e6137c93
Support creating VMs from multiple threads in C-bindings
...
Since all VM instances are managed by a global map, read/write of the
global map must be protected by a mutex.
2020-11-23 19:18:40 +01:00
Stanisław Barzowski
0d1d4cb812
Release 0.17.0
2020-11-22 15:45:52 +01:00
Stanisław Barzowski
5c08e370d3
Fix missing stack trace entry for assertions.
...
Fixes #467
2020-11-21 18:31:58 +01:00
Stanisław Barzowski
372c2ad732
Release GIL in Python bindings.
...
We apply the same changes as:
https://github.com/google/jsonnet/pull/814
2020-11-21 18:00:35 +01:00
Stanisław Barzowski
4f527c6f96
Add support for missing functions in C-bindings.
...
With this change we cover 100% of the C API.
2020-11-21 17:34:25 +01:00
Stanisław Barzowski
797bfd89ed
Better handling of stack traces.
...
Fixes multiple issues with stack traces leading to missing
stack trace lines. Also, we no longer put builtin context
on the line which *calls* the builtin as if it was a part
of the builtin itself.
Code for stack trace handling was centralized. We no longer
need traceElement argument in ~every function. Now the stack
trace state is kept solely in the interpreter.
2020-11-21 15:36:05 +01:00
Stanisław Barzowski
e120148a45
Add a short script for updating cpp-jsonnet.
2020-11-21 15:26:25 +01:00
Stanisław Barzowski
2bc774a030
Update cpp-jsonnet. Stop changing cpp-jsonnet version in tests.sh.
2020-11-21 15:10:43 +01:00
Stanisław Barzowski
fe28095772
Support for array comparison
2020-10-30 20:42:46 +01:00
Zhongpeng Lin
eced33e88b
Using cpp_jsonnet as external repo
2020-10-30 19:45:27 +01:00
Stanisław Barzowski
570101d43c
Desugar locals in object comprehension.
...
Desugar the locals in object comprehensions
"traditionally" instead of handling them manually.
Object comprehensions allow the locals to depend
on the index variable which means that they are separate
for each field. It doesn't make sense to treat them as
a property of the whole object.
Fixes #358 .
2020-10-22 14:54:50 +02:00
Sargun Dhillon
6967a29721
Add debian package build to goreleaser
...
This makes the goreleaser output two debian packages. One for jsonnet,
and another for jsonnetfmt. Since we don't use cgo, we don't need to
take dependencies, as we're fully statically linked. The package
name for this package will be jsonnet-go, and jsonnetfmt-go. There
is a package that Ubuntu has released that's based on the C++
version. We have a conflict statement with it in order to
avoid people installing both.
We can ask the C++ package to rename itself to jsonnet-c++, and then
add a provides for the package name jsonnet. The reason to not name
this jsonnet immediately, even though the Go version if meant to
supercede the C++ version, is that this doesn't fully implement the
C++ version (for example, man pages).
2020-10-05 20:40:24 +02:00
Stanisław Barzowski
755ee1ee88
Change CI settings to use the latest release, but not the tip.
2020-10-05 20:39:32 +02:00