Page 2 of 2

Re: FastStringSplit improve speed ...

Posted: Sun Dec 24, 2017 7:03 pm
by skywalk
nco2k wrote:>> SplitC() does not catch a trailing null?
yes, thats by design. why would you want to do that anyway? i mean you can change it if you really want to, i just dont see the point.
It is the same issue I mentioned prior: "1,2,3,," Splits to [1][2][3][][]. 5 members with 2 nulls.

>> My Split() uses a CountString() at beginning.
not a good idea. browsing through the string twice, will give you terrible performance. this might be ok for such a small string, but now try it with a large string. the bigger the string is, the more your procedure will fall behind. and dont use a string parameter. use a pointer instead: http://www.purebasic.fr/english/viewtop ... 98#p513698
Thanks, I have refactored some functions based on your suggestion. I will post delta times later.
EDIT:
Updated my prior Split() code with nco2k's suggestions and ran speed comparisons for short and long strings vs several Split() approaches.
EDIT2:
Modified nco2k's SplitC() to retain final trailing null's. Shaved some more time off Split(). All the Splitxx() routines now return same number of strings for a given input.
EDIT3:
nco2k simplified SplitC() further, shaving off more ms.
EDIT4:
Modified Split(),SplitC() to avoid 'Pointer is null' if pointing to an array element = Empty$.

Re: FastStringSplit improve speed ...

Posted: Thu Jul 22, 2021 10:36 pm
by highend
Trying to compile the code from
viewtopic.php?p=516077#p516077
for a x64 executable leads to:

Code: Select all

Line xx: _wcslen_() is not a function, array, list, map or macro
How to fix that?

Re: FastStringSplit improve speed ...

Posted: Fri Jul 23, 2021 1:40 am
by Demivec
highend wrote: Thu Jul 22, 2021 10:36 pm Trying to compile the code from
viewtopic.php?p=516077#p516077
for a x64 executable leads to:

Code: Select all

Line xx: _wcslen_() is not a function, array, list, map or macro
How to fix that?
Looking at the code, it appears to be a typo. Correct it to read '_wcslen()' instead of '_wcslen_()'.

Re: FastStringSplit improve speed ...

Posted: Fri Jul 23, 2021 6:06 am
by highend
Correct it to read '_wcslen()' instead of '_wcslen_()'
Unfortunately, this doesn't work either.

This works:

Code: Select all

ImportC ""
  wcsstr(*str1, *str2)
  wcslen(*str)
EndImport
and replacing all "_" for wcsstr + wcslen in the procedure...