mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
builtin,strconv: speedup str.int()
conversions (without -prod)
This commit is contained in:
parent
a462610376
commit
fc8e3d0971
10 changed files with 63 additions and 30 deletions
|
@ -1,6 +1,7 @@
|
|||
module strings
|
||||
|
||||
// strings.repeat - fill a string with `n` repetitions of the character `c`
|
||||
[direct_array_access]
|
||||
pub fn repeat(c u8, n int) string {
|
||||
if n <= 0 {
|
||||
return ''
|
||||
|
@ -16,6 +17,7 @@ pub fn repeat(c u8, n int) string {
|
|||
// strings.repeat_string - gives you `n` repetitions of the substring `s`
|
||||
// Note: strings.repeat, that repeats a single byte, is between 2x
|
||||
// and 24x faster than strings.repeat_string called for a 1 char string.
|
||||
[direct_array_access]
|
||||
pub fn repeat_string(s string, n int) string {
|
||||
if n <= 0 || s.len == 0 {
|
||||
return ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue