Skip to content

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

@apjanke

Description

@apjanke

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions