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

1574 Commits

Author SHA1 Message Date
Delyan Angelov
884fbb0a98
builtin: implement string_from_wide/1 and string_from_wide2/2 on *nix too (#18776) 2023-07-04 15:49:15 +03:00
Delyan Angelov
9bf2449a7b
cgen: fix memleak for [][]T{len: x}, or []Struct{len: x} (#18763) 2023-07-04 06:32:19 +03:00
Delyan Angelov
4c9c515f8b
parser: remove hardcoded check for function calls for C.stat, C.sigaction, etc (#18535) 2023-06-24 08:03:12 +03:00
yuyi
d7a50b4a22
builtin: minor cleanup in sorted_map.v (#18502) 2023-06-21 12:34:05 +03:00
Ethan Hansen
5001b17336
docs: add docstring for map.move() (#18430) 2023-06-16 09:45:16 +03:00
Delyan Angelov
6806086bf1
builtin: zero out internal map/array pointers on m.free(), to reduce the work for the GC mark phase for non escaping maps/arrays, used in hot loops (#18415) 2023-06-14 15:00:36 +03:00
sandbankdisperser
e97aff8742
time: add more detailed error descriptions, add custom format parsing with time.parse_format (#18257) 2023-06-06 18:43:10 +03:00
Delyan Angelov
d47c722c1f
builtin: fix byte deprecation warnings for v test-all (the -freestanding compilation) 2023-05-29 13:20:29 +03:00
Alexander Medvednikov
f22ba836fd prealloc: use u8 instead of byte 2023-05-29 01:42:52 +02:00
Ikko Eltociear Ashimine
abcbba1e81
builtin: fix typo in string.js.v (#18213) 2023-05-21 02:46:11 +03:00
Petr Makhnev
9d0a1d8496
builtin: speed up string methods with vmemcpy instead of for loop for copying data (#18211) 2023-05-19 21:24:23 +03:00
Petr Makhnev
a39c26507c
builtin: speed up string concatenation and repeat() method with vmemcpy instead of for loop for copying data (#18206)
These changes almost do not speed up the program with the `-prod` flag,
since modern С compilers can do such optimization on their own, but in
normal mode, the performance gain is from 1.6 (concatenation) to 1.8 (repeat) times.

Concatenation:
Old (`for` loop):
Time (mean):          3.699 s +- 0.071 s  [User: 3.629 s, System: 0.069 s]
Range (min ... max):  3.548 s ... 3.741 s  10 runs

New (vmemcpy):
Time (mean):          2.305 s +- 0.065 s  [User: 2.263 s, System: 0.041 s]
Range (min ... max):  2.172 s ... 2.355 s  10 runs

`vmemcpy version` ran 1.60 +- 0.05 times faster than 'for loop version'
2023-05-19 16:18:23 +03:00
Felipe Pena
47761a42e9
all: attr for enum fields (+ json encode/decode) (#18163) 2023-05-13 01:08:30 +02:00
Felipe Pena
5008515b03
builtin: heap memory usage api (#18103) 2023-05-03 20:33:52 +03:00
Swastik Baranwal
d3de7adcc0
builtin: add C.scanf fn decl to cfns.c.v (#17965) 2023-04-16 08:00:19 +03:00
Alexander Medvednikov
9f5e2aeea9 backtrace: use unsafe { nil } 2023-04-14 08:28:22 +02:00
Swastik Baranwal
3d99f1f2c2
checker: disallow struct int to ptr outside unsafe (#17923) 2023-04-13 07:38:21 +02:00
lapingenieur
f9c186a400
builtin: correct a small documentation mistake (#17935) 2023-04-11 12:37:14 +02:00
Delyan Angelov
abe0ad886b
ci: workaround flakyness of array_test.v on windows, with the default GC mode 2023-04-09 09:48:15 +03:00
Delyan Angelov
ebfc4b4663
builtin: remove test for the deprecated []int.reduce/2 2023-04-08 18:47:04 +03:00
yuyi
467a1b4435
fmt: remove redundant parenthesis in the complex infix expr (#17873) 2023-04-04 13:47:48 +03:00
Alexander Medvednikov
6756d28595 all: 2023 copyright 2023-03-28 22:55:57 +02:00
Delyan Angelov
3793bf1c99
builtin: optimise the common case of s.contains("x") add s.contains_byte(x) (#17702) 2023-03-19 01:10:13 +03:00
Felipe Pena
3197ec1a41
v: add compile-time enum evaluation with $for item in MyEnum.fields { dump(item.value) dump(item.name) } (#17517) 2023-03-12 12:46:54 +02:00
ChAoS_UnItY
f02b423f80
builtin: string test refactor, string functions inlining (#17598) 2023-03-11 20:44:45 +02:00
ChAoS_UnItY
9fa49da9d5
builtin: add rsplit functions (#17577) 2023-03-11 00:07:02 +01:00
ChAoS_UnItY
ae6a48c0e3
all: rename it to index in array inits (#17543) 2023-03-08 20:51:45 +01:00
l-m
6f7192359a
wasm: bug fixes and memory based changes (#17497) 2023-03-04 11:24:33 +02:00
yuyi
17000ef7b6
checker: check option fn returning error (fix #17423) (#17438) 2023-03-02 15:49:50 +02:00
l-m
0625caad56
wasm: add a webassembly compiler backend, based on using binaryen (#17368) 2023-02-28 23:58:53 +02:00
yuyi
93a3f5ff7d
builtin, cgen: fix array of struct with map field initialize (fix #17325) (#17340) 2023-02-18 20:34:15 +02:00
Felipe Pena
2879c5110c
cgen, check, parser: implement first-class option type (#17017) 2023-02-18 11:45:01 +02:00
ChAoS_UnItY
0b7a1cd7ce
v: forbid local variable names, shadowing imported module names (#17197) 2023-02-03 09:09:41 +02:00
Makhnev Petr
0874376db0
builtin: fix wrong module name imported in vlib/builtin/linux_bare/old/.checks/linuxsys/linuxsys.v (#17102) 2023-01-24 22:19:30 +02:00
Makhnev Petr
17d65db828
builtin: add string.trim_indent()` method (#17099) 2023-01-24 21:41:25 +02:00
Roy Ivy III
5cd074a49e
builtin: improve multi-platform portability for string.split_into_lines() (#17078) 2023-01-24 10:02:25 +02:00
MatejMagat305
6d223b9a26
builtin: add a map.reserve/1 method (#17052) 2023-01-23 11:07:25 +02:00
Swastik Baranwal
413a8b5f87
comptime: implement field.is_enum (#16920) 2023-01-09 20:12:07 +02:00
JalonSolov
90941b3b1f
all: change optional to option (#16914) 2023-01-09 09:36:45 +03:00
Alexander Medvednikov
868908b80d checker: require unsafe for Struct(voidptr) casts 2023-01-06 09:28:11 +03:00
Delyan Angelov
a6bf20f3be
builtin: add .is_alias to FieldData too (part 1, unimplemented yet) 2022-12-29 12:43:55 +02:00
Delyan Angelov
a8f6f9ed60
checker: more precise error handling of large binary literals like 0b1000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000 (#16775) 2022-12-27 15:13:15 +02:00
Delyan Angelov
3d545ee0cd
builtin: add more fields to FieldData (will be implemented later in a PR, to ease bootstrapping) 2022-12-26 16:05:14 +02:00
Felipe Pena
6a179a2926
checker: add int signedness mismatch checking for function call arguments (#16750) 2022-12-24 06:28:35 +02:00
Delyan Angelov
fc5826b7ca
cgen: minimise sizeof(EmptyStruct) to 0 for gcc/clang and to 1 for tcc/msvc, by changing EMPTY_STRUCT_DECLARATION and EMPTY_STRUCT_INITIALIZATION (#16733) 2022-12-22 21:47:39 +02:00
yuyi
e01dac885c
builtin: fix m.len to 0, after calling map.clear() (#16720) 2022-12-22 21:36:33 +02:00
Delyan Angelov
f9043c84a7
builtin: optimise the initialisation of the common 1 byte element arrays []u8 2022-12-22 20:41:32 +02:00
Delyan Angelov
8f8a186158
builtin: support -d trace_vmemset, -d trace_vmemcmp, -d trace_vmemmove and -d trace_vmemcpy too 2022-12-22 20:08:53 +02:00
Delyan Angelov
b67705f568
builtin: move the -d trace_*alloc lines at the start of their corresponding functions, implement -d trace_memdup too 2022-12-22 19:36:15 +02:00
Delyan Angelov
3da4f37b01
cgen: improve generated source compatibility with latest Alpine (lacking libexecinfo-dev and execinfo.h) and the prebuilt tcc (#16743) 2022-12-22 15:01:51 +02:00