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

[SR-13544] Comparing String or SubString performance #55981

Open
swift-ci opened this issue Sep 12, 2020 · 1 comment
Open

[SR-13544] Comparing String or SubString performance #55981

swift-ci opened this issue Sep 12, 2020 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-13544
Radar rdar://problem/68927130
Original Reporter lucol (JIRA User)
Type Bug

Attachment: Download

Environment

MacBook Pro (16- 2019)

2.4 GHz 8-Core Intel Core i9

32 GB 2667 MHz DDR4

Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 98b9a9a5273cb0eb0467aa1c5952e983

Issue Description:

I was demonstrating "by hand" sorting, with a very simple-swap-algorithm, on a shuffled file of 25,000 long paths accounting 4,095,501 chars, got form my home dir listing.

The algorithm didn't end after 40 min when the string is split by lines with split(separator:) generating SubString's, while it complets in about 35 sec when string is split with components(separatedBy:) generating String's.

I made a test with the same simple-swap-algorithm on a randomly generated string of 10,000 lines being 1024 chars length. But I randomly generated string one with pretty simple ASCII like chars and one with decomposed chars (áàâéèíìñòôúùûÁÀÂÉÈÊíÌÓÒÔÚÙÛ).

The result seams to be the opposite of my first test

Simple string w\ components(separatedBy:) => avg. 4.73

Simple string w\ split(separator:) => avg. 41.8

Complexe string w\ components(separatedBy:) => avg. 3.05

Complexe string w\ split(separator:) => avg. 4.06

(attached my test files including dir listing)

@typesanitizer
Copy link

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

2 participants