1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
Commit Graph

247 Commits

Author SHA1 Message Date
Delyan Angelov
56cf0b0a2e
builtin: inline manually isnil calls in array.push_many (very frequently called) 2022-05-07 12:55:40 +03:00
Delyan Angelov
1a4d9017e2
builtin: improve support for large arrays ([]int{len: 1_000_000_000} now works), fix an arr.repeat() bug (#14294) 2022-05-04 18:42:06 +03:00
Delyan Angelov
cc8803c602
builtin: fix failing embed_file_test.v (pub fn (data &u8) vbytes(len int) []u8 {) 2022-04-15 19:57:00 +03:00
Alexander Medvednikov
fbb9e65c0f all: ~500 more byte=>u8 2022-04-15 18:25:45 +03:00
Alexander Medvednikov
fb192d949b all: replace []byte with []u8 2022-04-15 15:35:35 +03:00
Alexander Medvednikov
d4a0d6f73c all: byte => u8 2022-04-15 14:58:56 +03:00
Alexander Medvednikov
e6ff1508d2 all: make u8 the primary type, byte the alias 2022-04-15 13:43:03 +03:00
Nick Treleaven
782d5374c9
builtin: add an array.drop(n) method (#13907) 2022-04-03 17:05:50 +03:00
yuyi
8c55a9ecd3
builtin: minor optimization of array.push() and array.push_noscan() (#13904) 2022-04-03 11:04:18 +03:00
Nick Treleaven
a87cd9663e
vdoc: highlight inline examples for -f html (#13879) 2022-03-31 19:32:32 +03:00
Nick Treleaven
02f72c8230
builtin: improve docs for array methods that take an it expression, like .map, .filter etc (#13836)
Move explanation about boolean `it` expressions to `filter`, as `sort`
doesn't take a boolean expression. Also move `any` example.
Add 2 filter examples.
Add map example from docs.md.
2022-03-27 14:28:15 +03:00
Delyan Angelov
5b492e26dd
builtin: support a.flags.set(.noslices | .noshrink), use it in the particles example (#13818) 2022-03-24 23:37:13 +02:00
Nick Treleaven
afbccf79f7
builtin: don't memdup element for array.pop (depends on how cgen works) (#13789)
The voidptr returned is immediately dereferenced in cgen so the memory
is copied before the array can be appended to: `*(int*)array_pop(&a)`
2022-03-21 23:34:35 +02:00
Delyan Angelov
71edaa071a
builtin: use malloc, instead of calloc in array.ensure_cap/1 2022-03-20 15:08:42 +02:00
Delyan Angelov
8ab0bcb6aa
Revert "builtin: improve performance for common array ops, based on VTune analysis"
This reverts commit 57db261538.
2022-03-20 12:57:27 +02:00
Delyan Angelov
57db261538
builtin: improve performance for common array ops, based on VTune analysis 2022-03-20 12:42:04 +02:00
Delyan Angelov
8dc4b1d9a3
builtin: use malloc_noscan more (for map metas and in []byte.hex()) 2022-03-11 11:26:22 +02:00
Nick Treleaven
7231a3f135
vlib: add mut for the first parameter of builtin.copy, arrays.copy and crypto (#13702) 2022-03-09 20:26:00 +02:00
Nick Treleaven
54de04a916
arrays: improve fold/reduce docs (#13700) 2022-03-09 20:04:49 +02:00
Nick Treleaven
17fcc788f2
arrays: add generic copy fn (#13677) 2022-03-08 09:44:04 +02:00
Alexander Medvednikov
36ec47cd20 all: replace "NB:" with "Note:" (docs/comments) 2022-03-06 20:01:22 +03:00
Delyan Angelov
9344c27021
builtin: save a call to array.ensure_cap in array.insert, array.push, array.push_many in most cases 2022-02-02 11:01:07 +02:00
Benjamin Stigsen
ceb05b163a
strings: rename Builder.write_b() to Builder.write_byte(), add deprecation (#13313) 2022-01-28 20:34:44 +02:00
jeffmikels
f19197f9b0
builtin: make array.insert_many and array.prepend_many private (#13172) 2022-01-14 19:47:17 +02:00
jeffmikels
9329b6c8c8
builtin: add more documentation (#13160) 2022-01-14 17:27:38 +02:00
Alexander Medvednikov
59ed4be49a all: update copyright year 2022-01-04 12:21:12 +03:00
penguindark
278c08704c
all: support slices with negative indexes #[start..end] (gated arrays) (#12914) 2021-12-22 16:34:02 +03:00
yuyi
7c255f0ff2
builtin, cgen: fix array of map init with default value (#12885) 2021-12-18 10:07:25 +02:00
yuyi
7c7cdf8ce7
builtin: clean up array.v (#12784) 2021-12-11 11:17:00 +03:00
Delyan Angelov
31fe02de8c
builtin,crypto: fix problems detected by -fsanitize=address,undefined and -fsanitize=memory 2021-11-28 20:35:18 +02:00
Delyan Angelov
1aaac13a60
cgen: make os less special, fix an -autofree leak on just import os
* Improve documentation of v.util.Surrounder

* Remove `os` from the list of "no auto free" `builtin` mods

* Fix -autofree freeing of `const x = []string{}`.

* Add a valgrind regression test.

* Implement os.getenv_opt in vlib/os/environment.js.v too.
2021-11-21 21:50:10 +02:00
Delyan Angelov
6937074e7a
strings,builder: reduce V cgen and parser memory consumption, fix strings.Builder leak (#12342) 2021-10-31 12:58:55 +02:00
Delyan Angelov
579d5ae649
builtin,checker: add array.flags. Allow changing it in unsafe {} blocks 2021-10-31 11:04:56 +02:00
Delyan Angelov
b86c79329b
os, builtin: reduce leaks without -autofree 2021-10-29 15:49:30 +03:00
Delyan Angelov
475a2f9b43
ci: fix failing vlib/orm/orm_test.v 2021-10-28 17:33:18 +03:00
Delyan Angelov
4d0f6767b1
builtin: use malloc instead of calloc for []Type{cap: size} 2021-10-28 17:18:03 +03:00
Enzo
e3b65092d6
parser: deprecate size_t (#11443) 2021-09-08 13:09:32 +03:00
yuyi
5181031480
builtin: check array.sort_with_compare() arg mismatch (#11385) 2021-09-04 15:02:05 +03:00
Delyan Angelov
47884dfd1f
builtin: move C. calls to .c.v files (#11164) 2021-08-12 21:46:38 +03:00
Enzo
506c30a291
builtin: remove methods that can be autogenerated (#11109) 2021-08-09 15:42:31 +03:00
Enzo
fc193bebf2
builtin: add documentation for builtin array functions (#11023) 2021-08-03 06:25:33 +03:00
yuyi
29cda252f1
builtin: fix multiple array init (#10929) 2021-07-23 23:25:12 +03:00
Uwe Krüger
41982053f1
builtin: make array.delete() reallocate, provide .delete_many() (#10889) 2021-07-21 20:55:32 +03:00
Alexander Medvednikov
41e88423aa Revert "builtin: use == 0 instead of isnil()"
This reverts commit 8650ec6916.
2021-07-01 06:21:03 +03:00
Delyan Angelov
63638fd271
cgen: optimize generated array.index(elem) 2021-06-28 17:45:13 +03:00
Delyan Angelov
8650ec6916
builtin: use == 0 instead of isnil()
Do not rely on C inlining that may not happen for a *very* frequently
called fn in lower level code.
2021-06-28 10:59:14 +03:00
Uwe Krüger
daeeaef030
vfmt: hot fix to allow separate array_d_gcboehm_opt.v (#10413) 2021-06-11 12:00:18 +03:00
Uwe Krüger
0e2c86310a
GC-boehm: extend optimized mode to all array methods (#10406) 2021-06-10 21:26:17 +03:00
Uwe Krüger
811a3e1d38
builtin: optimize array.repeat() (#10396) 2021-06-09 12:52:30 +03:00
Uwe Krüger
a2243054a5
builtin: fix memory corruption in array .clone() and .repeat() (#10394) 2021-06-08 23:23:28 +03:00