Patch 8.2.2736
Problem: Vim9: for loop over string is a bit slow.
Solution: Avoid using strlen().
Files: src/vim9execute.c
*** ../vim-8.2.2735/src/vim9execute.c 2021-04-04 20:49:46.626430253 +0200
--- src/vim9execute.c 2021-04-08 18:03:32.401252063 +0200
***************
*** 2792,2803 ****
else if (ltv->v_type == VAR_STRING)
{
char_u *str = ltv->vval.v_string;
- int len = str == NULL ? 0 : (int)STRLEN(str);
// Push the next character from the string. The index
// is for the last byte of the previous character.
++idxtv->vval.v_number;
! if (idxtv->vval.v_number >= len)
{
// past the end of the string, jump to "endfor"
ectx.ec_iidx = iptr->isn_arg.forloop.for_end;
--- 2792,2802 ----
else if (ltv->v_type == VAR_STRING)
{
char_u *str = ltv->vval.v_string;
// Push the next character from the string. The index
// is for the last byte of the previous character.
++idxtv->vval.v_number;
! if (str == NULL || str[idxtv->vval.v_number] == NUL)
{
// past the end of the string, jump to "endfor"
ectx.ec_iidx = iptr->isn_arg.forloop.for_end;
*** ../vim-8.2.2735/src/version.c 2021-04-07 21:58:13.203566847 +0200
--- src/version.c 2021-04-08 18:04:33.613105596 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2736,
/**/
--
hundred-and-one symptoms of being an internet addict:
90. Instead of calling you to dinner, your spouse sends e-mail.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202104081605.138G5QcY3893394%40masaka.moolenaar.net.