Aliaksandr Valialkin
32193b6059
lib/encoding: optimize UnmarshalVarUint64, UnmarshalVarInt64 and UnmarshalBytes a bit
...
Change the return values for these functions - now they return the unmarshaled result plus
the size of the unmarshaled result in bytes, so the caller could re-slice the src for further unmarshaling.
This improves performance of these functions in hot loops of VictoriaLogs a bit.
2024-05-14 01:30:25 +02:00
Aliaksandr Valialkin
9dc9c892b7
lib/encoding: optimizing UnmarshalVarUint64 and UnmarshalVarInt64 a bit
2024-05-12 16:35:24 +02:00
Aliaksandr Valialkin
87338633b1
lib/slicesutil: add helper functions for setting slice length and extending its capacity
...
The added helper functions - SetLength() and ExtendCapacity() - replace error-prone code with simple function calls.
2024-05-12 11:33:49 +02:00
Aliaksandr Valialkin
faeabfc730
lib/encoding: follow-up for 49e3665d6d
...
Improve performance for typical cases of varint marshaling / unmarshaling further.
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5721
2024-02-01 05:38:58 +02:00
Fuchun Zhang
78af9b3e30
make encoding.MarshalVarInt64s faster ( #5721 )
...
* make encoding.MarshalVarInt64s faster
* add fast path for MarshalVarInt64s
* make UnmarshalVarUint64s faster
* remove comment
2024-02-01 03:33:59 +00:00
Aliaksandr Valialkin
8dd73574ca
lib/encoding: remove uneeded re-slicing of byte slice before passing it to binary.BigEndian.Uint*
2024-01-23 22:50:11 +02:00
Aliaksandr Valialkin
4c80193a86
lib/encoding: add MarshalBool/UnmarshalBool and GetUint32s/PutUint32s functions
...
These functions are going to be used by VictoriaLogs
2023-07-06 17:24:52 -07:00
Aliaksandr Valialkin
4a3172f150
lib/encoding: explicitly set slice length passed to binary.BigEndian.Uint*
...
This allows Go complier to generate more optimal code without bound checks
2022-04-12 12:56:52 +03:00
Aliaksandr Valialkin
d962568e93
all: use %w instead of %s for wrapping errors in fmt.Errorf
...
This will simplify examining the returned errors such as httpserver.ErrorWithStatusCode .
See https://blog.golang.org/go1.13-errors for details.
2020-06-30 23:33:46 +03:00
Aliaksandr Valialkin
272e2f77c9
lib/encoding: optimize UnmarshalUint* and UnmarshalInt*
2019-09-20 13:08:24 +03:00
Aliaksandr Valialkin
1836c415e6
all: open-sourcing single-node version
2019-05-23 00:18:06 +03:00