feat: improve std.base64Decode performance 97%+
Provides a Go-native implementation of std.base64Decode and std.base64DecodeBytes
benchmark old ns/op new ns/op delta
Benchmark_Builtin_base64Decode-16 10946388307 25004135 -99.77%
Benchmark_Builtin_base64DecodeBytes-16 6420742757 181513016 -97.17%
related to #111
Implements std.reverse in native Go, improving performance
benchmark old ns/op new ns/op delta
Benchmark_Builtin_reverse-16 869191619 231309458 -73.39%
part of #111
This pulls in the implementation of substr into native Go instead of interpretted Jsonnet.
benchmark old ns/op new ns/op delta
Benchmark_Builtin_substr-16 97121527 15115905 -84.44%
part of #111
When adding long strings, don't copy them immediately. Instead
build long strings only when their contents are requested.
This allows to build a long string from parts, using a regular
operator+ in linear time. This lets users to worry much less
about using std.join etc.
If indexing the string is mixed with building it using operator+
the behavior can still be quadratic. We may want to address it in
a later change.
* feat(parser): export parser.Children
As parser was moved to internal/parser, it is not possible to import it into
external projects anymore.
However, parser.Children() is handy to use in static analysis tools, so it is
worth exporting. This does that by adding a stub package
`github.com/google/go-jsonnet/parser` that wraps the internal function.
Signed-off-by: sh0rez <me@shorez.de>
* Renamed jsonValue obj field to val
* Renamed jsonValue children field to owned + added an explicit comment about this field
* Got rid of unnecessary vm handle checks
* Renamed arg to param, identifiers to paramNames
* Raised maxID value to 100 000
* Removed freedIDs entry check
* Fixed jsonnet_json_array_append, jsonnet_json_object_append bugs
* jsonValue now stores the list of related struct_JsonnetJsonValue
instead of handles ids
* It adds new API which allows using VM for importing
files in external tools "just as Jsonnet would". This is
primarily intended for use in static analysis tools.
* Imports are now cached between evaluate calls. This may improve
performance significantly for some users. I would like to add
some way of achieving this with commandline in the future.
* Additional layer of caching was internally added - AST level.
This was necessary so that Jsonnet could always return the same
exact AST when asked multiple times (meaning the same pointers).
Sort is something that is highly optimized in most languages
and users can expect it to be fast. We can piggyback on
the Go implementation.
This change results in 100x speedup on bench.06.jsonnet.