Linux sort vs programmingLinux sort last columnWhat's the default order of Linux sort?resources for linux...
Packet sniffer for MacOS Mojave and above
Write to EXCEL from SQL DB using VBA script
Visa for volunteering in England
If 1. e4 c6 is considered as a sound defense for black, why is 1. c3 so rare?
Why is the SNP putting so much emphasis on currency plans?
How does NAND gate work? (Very basic question)
Can PCs use nonmagical armor and weapons looted from monsters?
Does hiding behind 5-ft-wide cover give full cover?
What happened to Rhaegal?
How to reply this mail from potential PhD professor?
Disabling Resource Governor in SQL Server
Junior developer struggles: how to communicate with management?
Save terminal output to a txt file
Feels like I am getting dragged into office politics
Was Hulk present at this event?
What happens if I start too many background jobs?
Field Length Validation for Desktop Application which has maximum 1000 characters
Why do computer-science majors learn calculus?
Was Unix ever a single-user OS?
When do aircrafts become solarcrafts?
How did Captain America use this power?
Stark VS Thanos
Can a cyclic Amine form an Amide?
You look catfish vs You look like a catfish?
Linux sort vs programming
Linux sort last columnWhat's the default order of Linux sort?resources for linux programmingsort command in unix with numeric sortSort huge list (130Gb) in LinuxSort files alphabetically with ls on Linux?sort linux in UTF8Sort with field separatorTerminal sort command options: sort -k1,1Trying to sort specific columns in linux
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I'm trying to grasp why my software (golang) is 350 times slower compared to linux sort command? I was sorting UTF-8 text file around 13.000.000 lines (4 - 20 bytes long).
code sample from my function (if checkDupl false append to newArray):
func checkDupl(in []byte) bool {
for i := range newArray {
if bytes.Equal(in, newArray[i]) {
return true
}
}
return false
}
This code finished around 25% over night.
This code finished in 8min:
497 export LC_ALL=C
498 time sort -us -o file_unique.txt file.txt
linux sort
add a comment |
I'm trying to grasp why my software (golang) is 350 times slower compared to linux sort command? I was sorting UTF-8 text file around 13.000.000 lines (4 - 20 bytes long).
code sample from my function (if checkDupl false append to newArray):
func checkDupl(in []byte) bool {
for i := range newArray {
if bytes.Equal(in, newArray[i]) {
return true
}
}
return false
}
This code finished around 25% over night.
This code finished in 8min:
497 export LC_ALL=C
498 time sort -us -o file_unique.txt file.txt
linux sort
Without the rest of your code it's a bit hard to tell, but that looks like it's going to be part of an O(N^2) implementation. All other things being the same that will be several hundred thousand times slower for your input size than whatsort
will do.
– Michael Homer
6 mins ago
add a comment |
I'm trying to grasp why my software (golang) is 350 times slower compared to linux sort command? I was sorting UTF-8 text file around 13.000.000 lines (4 - 20 bytes long).
code sample from my function (if checkDupl false append to newArray):
func checkDupl(in []byte) bool {
for i := range newArray {
if bytes.Equal(in, newArray[i]) {
return true
}
}
return false
}
This code finished around 25% over night.
This code finished in 8min:
497 export LC_ALL=C
498 time sort -us -o file_unique.txt file.txt
linux sort
I'm trying to grasp why my software (golang) is 350 times slower compared to linux sort command? I was sorting UTF-8 text file around 13.000.000 lines (4 - 20 bytes long).
code sample from my function (if checkDupl false append to newArray):
func checkDupl(in []byte) bool {
for i := range newArray {
if bytes.Equal(in, newArray[i]) {
return true
}
}
return false
}
This code finished around 25% over night.
This code finished in 8min:
497 export LC_ALL=C
498 time sort -us -o file_unique.txt file.txt
linux sort
linux sort
asked 11 mins ago
Raimonds LindeRaimonds Linde
11
11
Without the rest of your code it's a bit hard to tell, but that looks like it's going to be part of an O(N^2) implementation. All other things being the same that will be several hundred thousand times slower for your input size than whatsort
will do.
– Michael Homer
6 mins ago
add a comment |
Without the rest of your code it's a bit hard to tell, but that looks like it's going to be part of an O(N^2) implementation. All other things being the same that will be several hundred thousand times slower for your input size than whatsort
will do.
– Michael Homer
6 mins ago
Without the rest of your code it's a bit hard to tell, but that looks like it's going to be part of an O(N^2) implementation. All other things being the same that will be several hundred thousand times slower for your input size than what
sort
will do.– Michael Homer
6 mins ago
Without the rest of your code it's a bit hard to tell, but that looks like it's going to be part of an O(N^2) implementation. All other things being the same that will be several hundred thousand times slower for your input size than what
sort
will do.– Michael Homer
6 mins ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f516296%2flinux-sort-vs-programming%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f516296%2flinux-sort-vs-programming%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Without the rest of your code it's a bit hard to tell, but that looks like it's going to be part of an O(N^2) implementation. All other things being the same that will be several hundred thousand times slower for your input size than what
sort
will do.– Michael Homer
6 mins ago