Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmark str* methods (strjoin, erase, strsplit, startsWith) #6

Open
apjanke opened this issue Sep 15, 2021 · 1 comment
Open

Benchmark str* methods (strjoin, erase, strsplit, startsWith) #6

apjanke opened this issue Sep 15, 2021 · 1 comment
Assignees

Comments

@apjanke
Copy link
Member

apjanke commented Sep 15, 2021

FannoFlow: The most important benchmark i think is benching the str* functions with chars and cellstrs vs the string member methods
[8:41 PM] FannoFlow: Like join, erase, starts with, split, etc etc
[8:41 PM] FannoFlow: The container itself might have overhead, but it's the usability of the container
[8:57 PM] FannoFlow: !run
data = '1.21, a, 1.985, b, 1.955, c, 2.015, d, 1.885';
datasting = string(data)
tcellstr = timeit(@() str2double(erase(strsplit(data, ','),lettersPattern)))
tstring = timeit(@() datasting.split(",").erase(lettersPattern).double())
[8:57 PM]
BOT
MATLAB:
datasting =

"1.21, a, 1.985, b, 1.955, c, 2.015, d, 1.885"

tcellstr =

3.2287e-04

tstring =

2.9424e-05
[8:57 PM] FannoFlow: string ops order of magnitude faster
[8:57 PM] FannoFlow: and so much cleaner to read
[8:58 PM] FannoFlow: probs could be written a bit better to use more str functions
[8:58 PM] FannoFlow: but thats the idea, the comparison of cellstr operations to string array operations
[8:59 PM] FannoFlow: could do some big regex pattern search too or something

@apjanke apjanke self-assigned this Sep 15, 2021
@apjanke
Copy link
Member Author

apjanke commented Sep 15, 2021

Got most of these in. Still need to do startsWith and endsWith.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant