Use all 100% power of CPU with C#
i'm trying to rewrite Vanitygen in C#. This is my code for now
private void btnGenerate_Click(object sender, EventArgs e) {
KeyPair kp = KeyPair.Create(ExtraEntropy.GetEntropy()); //Generate private key
string wifprivatekey = new KeyPair(kp.PrivateKeyBytes).PrivateKeyBase58; //Create wif private key
string address = new AddressBase(kp, AddressTypeByte).AddressBase58);// Create base 58 address
if (address.StartsWith(pattern)) //compare value with input pattern
{
using (var writer = File.AppendText(@"C:Usersran242Desktopresult.txt"))
{
writer.WriteLine("Pattern: "+pattern);
writer.WriteLine("Address: "+address);
writer.WriteLine("Privatekey: "+wifprivatekey);
}
}
}
I test it to run mutiple time using Parallel.For
. The code run really slow for now, so i intend to improve the performance. When run on parallel, it can only check 1000 address for like 3 seconds & it didn't even use all CPU power
System.Threading.Tasks.Parallel.For(0, 1000, i =>
{
KeyPair kp = KeyPair.Create(ExtraEntropy.GetEntropy()); //Generate private key
string wifprivatekey = new KeyPair(kp.PrivateKeyBytes).PrivateKeyBase58; //Create wif private key
string address = new AddressBase(kp, AddressTypeByte).AddressBase58);// Create base 58 address
if (address.StartsWith(pattern)) //compare value with input pattern
{
using (var writer = File.AppendText(@"C:Usersran242Desktopresult.txt"))
{
writer.WriteLine("Pattern: "+pattern);
writer.WriteLine("Address: "+address);
writer.WriteLine("Privatekey: "+wifprivatekey);
}
}
});
Is there any method that i can improve the code & use 100% of my CPU or any CPU whenever i run this code on different computer? thank you
c# performance cryptography cpu
|
show 10 more comments
i'm trying to rewrite Vanitygen in C#. This is my code for now
private void btnGenerate_Click(object sender, EventArgs e) {
KeyPair kp = KeyPair.Create(ExtraEntropy.GetEntropy()); //Generate private key
string wifprivatekey = new KeyPair(kp.PrivateKeyBytes).PrivateKeyBase58; //Create wif private key
string address = new AddressBase(kp, AddressTypeByte).AddressBase58);// Create base 58 address
if (address.StartsWith(pattern)) //compare value with input pattern
{
using (var writer = File.AppendText(@"C:Usersran242Desktopresult.txt"))
{
writer.WriteLine("Pattern: "+pattern);
writer.WriteLine("Address: "+address);
writer.WriteLine("Privatekey: "+wifprivatekey);
}
}
}
I test it to run mutiple time using Parallel.For
. The code run really slow for now, so i intend to improve the performance. When run on parallel, it can only check 1000 address for like 3 seconds & it didn't even use all CPU power
System.Threading.Tasks.Parallel.For(0, 1000, i =>
{
KeyPair kp = KeyPair.Create(ExtraEntropy.GetEntropy()); //Generate private key
string wifprivatekey = new KeyPair(kp.PrivateKeyBytes).PrivateKeyBase58; //Create wif private key
string address = new AddressBase(kp, AddressTypeByte).AddressBase58);// Create base 58 address
if (address.StartsWith(pattern)) //compare value with input pattern
{
using (var writer = File.AppendText(@"C:Usersran242Desktopresult.txt"))
{
writer.WriteLine("Pattern: "+pattern);
writer.WriteLine("Address: "+address);
writer.WriteLine("Privatekey: "+wifprivatekey);
}
}
});
Is there any method that i can improve the code & use 100% of my CPU or any CPU whenever i run this code on different computer? thank you
c# performance cryptography cpu
1
You're doing file I/O - there is your bottleneck. Throwing threads at it is not going to improve anything
– MickyD
Nov 19 '18 at 3:54
I just remove file I/O & run it. It's pretty much the same performance :v
– Huang Lee
Nov 19 '18 at 3:57
2
As MickyD says it, this is not a CPU bound operation but a Disk bound one. If anything throwing more threads at it will add Thread management overhead, making it slower. | As for properly replicating Vanitygen: I doubt that will happen. It is written in C, wich allows all the Micro--optimsiations moderns day programmers do not deal with. .NET is in no way noticeably slwoer in common use cases, but that programm is a high performance BitCoin miner (I think, the description is wierd).
– Christopher
Nov 19 '18 at 3:58
1
I also noticed you got WriteLines in there. Writing to the user is expensive. If you only do it once per user triggered event, you will not notice. But from a loop, the speed of consoel drawing can easily become the bottleneck. Try just minimizing the Console window and see if the performance improoves. I run my fair share of console commands monthly, and if hte processing is short the Console overhead becoems massive.
– Christopher
Nov 19 '18 at 4:00
1
You're also writing to the same file from multiple threads... that's a recipe for disaster.
– Sunius
Nov 19 '18 at 4:03
|
show 10 more comments
i'm trying to rewrite Vanitygen in C#. This is my code for now
private void btnGenerate_Click(object sender, EventArgs e) {
KeyPair kp = KeyPair.Create(ExtraEntropy.GetEntropy()); //Generate private key
string wifprivatekey = new KeyPair(kp.PrivateKeyBytes).PrivateKeyBase58; //Create wif private key
string address = new AddressBase(kp, AddressTypeByte).AddressBase58);// Create base 58 address
if (address.StartsWith(pattern)) //compare value with input pattern
{
using (var writer = File.AppendText(@"C:Usersran242Desktopresult.txt"))
{
writer.WriteLine("Pattern: "+pattern);
writer.WriteLine("Address: "+address);
writer.WriteLine("Privatekey: "+wifprivatekey);
}
}
}
I test it to run mutiple time using Parallel.For
. The code run really slow for now, so i intend to improve the performance. When run on parallel, it can only check 1000 address for like 3 seconds & it didn't even use all CPU power
System.Threading.Tasks.Parallel.For(0, 1000, i =>
{
KeyPair kp = KeyPair.Create(ExtraEntropy.GetEntropy()); //Generate private key
string wifprivatekey = new KeyPair(kp.PrivateKeyBytes).PrivateKeyBase58; //Create wif private key
string address = new AddressBase(kp, AddressTypeByte).AddressBase58);// Create base 58 address
if (address.StartsWith(pattern)) //compare value with input pattern
{
using (var writer = File.AppendText(@"C:Usersran242Desktopresult.txt"))
{
writer.WriteLine("Pattern: "+pattern);
writer.WriteLine("Address: "+address);
writer.WriteLine("Privatekey: "+wifprivatekey);
}
}
});
Is there any method that i can improve the code & use 100% of my CPU or any CPU whenever i run this code on different computer? thank you
c# performance cryptography cpu
i'm trying to rewrite Vanitygen in C#. This is my code for now
private void btnGenerate_Click(object sender, EventArgs e) {
KeyPair kp = KeyPair.Create(ExtraEntropy.GetEntropy()); //Generate private key
string wifprivatekey = new KeyPair(kp.PrivateKeyBytes).PrivateKeyBase58; //Create wif private key
string address = new AddressBase(kp, AddressTypeByte).AddressBase58);// Create base 58 address
if (address.StartsWith(pattern)) //compare value with input pattern
{
using (var writer = File.AppendText(@"C:Usersran242Desktopresult.txt"))
{
writer.WriteLine("Pattern: "+pattern);
writer.WriteLine("Address: "+address);
writer.WriteLine("Privatekey: "+wifprivatekey);
}
}
}
I test it to run mutiple time using Parallel.For
. The code run really slow for now, so i intend to improve the performance. When run on parallel, it can only check 1000 address for like 3 seconds & it didn't even use all CPU power
System.Threading.Tasks.Parallel.For(0, 1000, i =>
{
KeyPair kp = KeyPair.Create(ExtraEntropy.GetEntropy()); //Generate private key
string wifprivatekey = new KeyPair(kp.PrivateKeyBytes).PrivateKeyBase58; //Create wif private key
string address = new AddressBase(kp, AddressTypeByte).AddressBase58);// Create base 58 address
if (address.StartsWith(pattern)) //compare value with input pattern
{
using (var writer = File.AppendText(@"C:Usersran242Desktopresult.txt"))
{
writer.WriteLine("Pattern: "+pattern);
writer.WriteLine("Address: "+address);
writer.WriteLine("Privatekey: "+wifprivatekey);
}
}
});
Is there any method that i can improve the code & use 100% of my CPU or any CPU whenever i run this code on different computer? thank you
c# performance cryptography cpu
c# performance cryptography cpu
asked Nov 19 '18 at 3:51
Huang LeeHuang Lee
278
278
1
You're doing file I/O - there is your bottleneck. Throwing threads at it is not going to improve anything
– MickyD
Nov 19 '18 at 3:54
I just remove file I/O & run it. It's pretty much the same performance :v
– Huang Lee
Nov 19 '18 at 3:57
2
As MickyD says it, this is not a CPU bound operation but a Disk bound one. If anything throwing more threads at it will add Thread management overhead, making it slower. | As for properly replicating Vanitygen: I doubt that will happen. It is written in C, wich allows all the Micro--optimsiations moderns day programmers do not deal with. .NET is in no way noticeably slwoer in common use cases, but that programm is a high performance BitCoin miner (I think, the description is wierd).
– Christopher
Nov 19 '18 at 3:58
1
I also noticed you got WriteLines in there. Writing to the user is expensive. If you only do it once per user triggered event, you will not notice. But from a loop, the speed of consoel drawing can easily become the bottleneck. Try just minimizing the Console window and see if the performance improoves. I run my fair share of console commands monthly, and if hte processing is short the Console overhead becoems massive.
– Christopher
Nov 19 '18 at 4:00
1
You're also writing to the same file from multiple threads... that's a recipe for disaster.
– Sunius
Nov 19 '18 at 4:03
|
show 10 more comments
1
You're doing file I/O - there is your bottleneck. Throwing threads at it is not going to improve anything
– MickyD
Nov 19 '18 at 3:54
I just remove file I/O & run it. It's pretty much the same performance :v
– Huang Lee
Nov 19 '18 at 3:57
2
As MickyD says it, this is not a CPU bound operation but a Disk bound one. If anything throwing more threads at it will add Thread management overhead, making it slower. | As for properly replicating Vanitygen: I doubt that will happen. It is written in C, wich allows all the Micro--optimsiations moderns day programmers do not deal with. .NET is in no way noticeably slwoer in common use cases, but that programm is a high performance BitCoin miner (I think, the description is wierd).
– Christopher
Nov 19 '18 at 3:58
1
I also noticed you got WriteLines in there. Writing to the user is expensive. If you only do it once per user triggered event, you will not notice. But from a loop, the speed of consoel drawing can easily become the bottleneck. Try just minimizing the Console window and see if the performance improoves. I run my fair share of console commands monthly, and if hte processing is short the Console overhead becoems massive.
– Christopher
Nov 19 '18 at 4:00
1
You're also writing to the same file from multiple threads... that's a recipe for disaster.
– Sunius
Nov 19 '18 at 4:03
1
1
You're doing file I/O - there is your bottleneck. Throwing threads at it is not going to improve anything
– MickyD
Nov 19 '18 at 3:54
You're doing file I/O - there is your bottleneck. Throwing threads at it is not going to improve anything
– MickyD
Nov 19 '18 at 3:54
I just remove file I/O & run it. It's pretty much the same performance :v
– Huang Lee
Nov 19 '18 at 3:57
I just remove file I/O & run it. It's pretty much the same performance :v
– Huang Lee
Nov 19 '18 at 3:57
2
2
As MickyD says it, this is not a CPU bound operation but a Disk bound one. If anything throwing more threads at it will add Thread management overhead, making it slower. | As for properly replicating Vanitygen: I doubt that will happen. It is written in C, wich allows all the Micro--optimsiations moderns day programmers do not deal with. .NET is in no way noticeably slwoer in common use cases, but that programm is a high performance BitCoin miner (I think, the description is wierd).
– Christopher
Nov 19 '18 at 3:58
As MickyD says it, this is not a CPU bound operation but a Disk bound one. If anything throwing more threads at it will add Thread management overhead, making it slower. | As for properly replicating Vanitygen: I doubt that will happen. It is written in C, wich allows all the Micro--optimsiations moderns day programmers do not deal with. .NET is in no way noticeably slwoer in common use cases, but that programm is a high performance BitCoin miner (I think, the description is wierd).
– Christopher
Nov 19 '18 at 3:58
1
1
I also noticed you got WriteLines in there. Writing to the user is expensive. If you only do it once per user triggered event, you will not notice. But from a loop, the speed of consoel drawing can easily become the bottleneck. Try just minimizing the Console window and see if the performance improoves. I run my fair share of console commands monthly, and if hte processing is short the Console overhead becoems massive.
– Christopher
Nov 19 '18 at 4:00
I also noticed you got WriteLines in there. Writing to the user is expensive. If you only do it once per user triggered event, you will not notice. But from a loop, the speed of consoel drawing can easily become the bottleneck. Try just minimizing the Console window and see if the performance improoves. I run my fair share of console commands monthly, and if hte processing is short the Console overhead becoems massive.
– Christopher
Nov 19 '18 at 4:00
1
1
You're also writing to the same file from multiple threads... that's a recipe for disaster.
– Sunius
Nov 19 '18 at 4:03
You're also writing to the same file from multiple threads... that's a recipe for disaster.
– Sunius
Nov 19 '18 at 4:03
|
show 10 more comments
1 Answer
1
active
oldest
votes
What are you trying to do is close to realtime progtramming. That is not something you can just do or learn on a whim.
Realtime Proramming is a highly specialized area of programming, with specialized Operating Systems. One for wich C# and .NET are pretty unsuited to begin with. A JiT compiled, Garbage Collected runtime is not the right environment for Realtime Programming. That is why the original programm was written in C.
As best as I can tell, you are trying to programm way above your skill level. You need to learn Multitasking first before you even got a shoot at it. Then you need to know if this problem is even Pleasingly Paralelizeable or at when it suffers Paralell Slowdown. On your comptuer, mind you. Stuff like the Swapfile can easily get in the way of this kind of performance.
ok, before i close this discussion. Can you have any knowledge about this? my school server have System Configuration like this: General purpose CPU nodes: 236 nodes (471.24 TFLOPS) CPU : Intel Xeon Gold 6126 (Skylake / 2.6 GHz 12 cores) 2 CPUs Memory : 192GB. If i run this code on it wouldn't it run any faster?
– Huang Lee
Nov 19 '18 at 4:24
@HuangLee: Way to much uncertainty to give you a answer. Indeed the best I can do is give you the speed rant: ericlippert.com/2012/12/17/performance-rant
– Christopher
Nov 19 '18 at 4:26
@HuangLee i would think very seriously about your next comments, what you are doing if you could, would probably get you kicked out of school
– TheGeneral
Nov 19 '18 at 4:28
@TheGeneral lol, no. you could send request to use school system in a day or two. as long as it not hacking or stealing things
– Huang Lee
Nov 19 '18 at 4:36
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2fstackoverflow.com%2fquestions%2f53368081%2fuse-all-100-power-of-cpu-with-c-sharp%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
What are you trying to do is close to realtime progtramming. That is not something you can just do or learn on a whim.
Realtime Proramming is a highly specialized area of programming, with specialized Operating Systems. One for wich C# and .NET are pretty unsuited to begin with. A JiT compiled, Garbage Collected runtime is not the right environment for Realtime Programming. That is why the original programm was written in C.
As best as I can tell, you are trying to programm way above your skill level. You need to learn Multitasking first before you even got a shoot at it. Then you need to know if this problem is even Pleasingly Paralelizeable or at when it suffers Paralell Slowdown. On your comptuer, mind you. Stuff like the Swapfile can easily get in the way of this kind of performance.
ok, before i close this discussion. Can you have any knowledge about this? my school server have System Configuration like this: General purpose CPU nodes: 236 nodes (471.24 TFLOPS) CPU : Intel Xeon Gold 6126 (Skylake / 2.6 GHz 12 cores) 2 CPUs Memory : 192GB. If i run this code on it wouldn't it run any faster?
– Huang Lee
Nov 19 '18 at 4:24
@HuangLee: Way to much uncertainty to give you a answer. Indeed the best I can do is give you the speed rant: ericlippert.com/2012/12/17/performance-rant
– Christopher
Nov 19 '18 at 4:26
@HuangLee i would think very seriously about your next comments, what you are doing if you could, would probably get you kicked out of school
– TheGeneral
Nov 19 '18 at 4:28
@TheGeneral lol, no. you could send request to use school system in a day or two. as long as it not hacking or stealing things
– Huang Lee
Nov 19 '18 at 4:36
add a comment |
What are you trying to do is close to realtime progtramming. That is not something you can just do or learn on a whim.
Realtime Proramming is a highly specialized area of programming, with specialized Operating Systems. One for wich C# and .NET are pretty unsuited to begin with. A JiT compiled, Garbage Collected runtime is not the right environment for Realtime Programming. That is why the original programm was written in C.
As best as I can tell, you are trying to programm way above your skill level. You need to learn Multitasking first before you even got a shoot at it. Then you need to know if this problem is even Pleasingly Paralelizeable or at when it suffers Paralell Slowdown. On your comptuer, mind you. Stuff like the Swapfile can easily get in the way of this kind of performance.
ok, before i close this discussion. Can you have any knowledge about this? my school server have System Configuration like this: General purpose CPU nodes: 236 nodes (471.24 TFLOPS) CPU : Intel Xeon Gold 6126 (Skylake / 2.6 GHz 12 cores) 2 CPUs Memory : 192GB. If i run this code on it wouldn't it run any faster?
– Huang Lee
Nov 19 '18 at 4:24
@HuangLee: Way to much uncertainty to give you a answer. Indeed the best I can do is give you the speed rant: ericlippert.com/2012/12/17/performance-rant
– Christopher
Nov 19 '18 at 4:26
@HuangLee i would think very seriously about your next comments, what you are doing if you could, would probably get you kicked out of school
– TheGeneral
Nov 19 '18 at 4:28
@TheGeneral lol, no. you could send request to use school system in a day or two. as long as it not hacking or stealing things
– Huang Lee
Nov 19 '18 at 4:36
add a comment |
What are you trying to do is close to realtime progtramming. That is not something you can just do or learn on a whim.
Realtime Proramming is a highly specialized area of programming, with specialized Operating Systems. One for wich C# and .NET are pretty unsuited to begin with. A JiT compiled, Garbage Collected runtime is not the right environment for Realtime Programming. That is why the original programm was written in C.
As best as I can tell, you are trying to programm way above your skill level. You need to learn Multitasking first before you even got a shoot at it. Then you need to know if this problem is even Pleasingly Paralelizeable or at when it suffers Paralell Slowdown. On your comptuer, mind you. Stuff like the Swapfile can easily get in the way of this kind of performance.
What are you trying to do is close to realtime progtramming. That is not something you can just do or learn on a whim.
Realtime Proramming is a highly specialized area of programming, with specialized Operating Systems. One for wich C# and .NET are pretty unsuited to begin with. A JiT compiled, Garbage Collected runtime is not the right environment for Realtime Programming. That is why the original programm was written in C.
As best as I can tell, you are trying to programm way above your skill level. You need to learn Multitasking first before you even got a shoot at it. Then you need to know if this problem is even Pleasingly Paralelizeable or at when it suffers Paralell Slowdown. On your comptuer, mind you. Stuff like the Swapfile can easily get in the way of this kind of performance.
answered Nov 19 '18 at 4:10
ChristopherChristopher
2,8432623
2,8432623
ok, before i close this discussion. Can you have any knowledge about this? my school server have System Configuration like this: General purpose CPU nodes: 236 nodes (471.24 TFLOPS) CPU : Intel Xeon Gold 6126 (Skylake / 2.6 GHz 12 cores) 2 CPUs Memory : 192GB. If i run this code on it wouldn't it run any faster?
– Huang Lee
Nov 19 '18 at 4:24
@HuangLee: Way to much uncertainty to give you a answer. Indeed the best I can do is give you the speed rant: ericlippert.com/2012/12/17/performance-rant
– Christopher
Nov 19 '18 at 4:26
@HuangLee i would think very seriously about your next comments, what you are doing if you could, would probably get you kicked out of school
– TheGeneral
Nov 19 '18 at 4:28
@TheGeneral lol, no. you could send request to use school system in a day or two. as long as it not hacking or stealing things
– Huang Lee
Nov 19 '18 at 4:36
add a comment |
ok, before i close this discussion. Can you have any knowledge about this? my school server have System Configuration like this: General purpose CPU nodes: 236 nodes (471.24 TFLOPS) CPU : Intel Xeon Gold 6126 (Skylake / 2.6 GHz 12 cores) 2 CPUs Memory : 192GB. If i run this code on it wouldn't it run any faster?
– Huang Lee
Nov 19 '18 at 4:24
@HuangLee: Way to much uncertainty to give you a answer. Indeed the best I can do is give you the speed rant: ericlippert.com/2012/12/17/performance-rant
– Christopher
Nov 19 '18 at 4:26
@HuangLee i would think very seriously about your next comments, what you are doing if you could, would probably get you kicked out of school
– TheGeneral
Nov 19 '18 at 4:28
@TheGeneral lol, no. you could send request to use school system in a day or two. as long as it not hacking or stealing things
– Huang Lee
Nov 19 '18 at 4:36
ok, before i close this discussion. Can you have any knowledge about this? my school server have System Configuration like this: General purpose CPU nodes: 236 nodes (471.24 TFLOPS) CPU : Intel Xeon Gold 6126 (Skylake / 2.6 GHz 12 cores) 2 CPUs Memory : 192GB. If i run this code on it wouldn't it run any faster?
– Huang Lee
Nov 19 '18 at 4:24
ok, before i close this discussion. Can you have any knowledge about this? my school server have System Configuration like this: General purpose CPU nodes: 236 nodes (471.24 TFLOPS) CPU : Intel Xeon Gold 6126 (Skylake / 2.6 GHz 12 cores) 2 CPUs Memory : 192GB. If i run this code on it wouldn't it run any faster?
– Huang Lee
Nov 19 '18 at 4:24
@HuangLee: Way to much uncertainty to give you a answer. Indeed the best I can do is give you the speed rant: ericlippert.com/2012/12/17/performance-rant
– Christopher
Nov 19 '18 at 4:26
@HuangLee: Way to much uncertainty to give you a answer. Indeed the best I can do is give you the speed rant: ericlippert.com/2012/12/17/performance-rant
– Christopher
Nov 19 '18 at 4:26
@HuangLee i would think very seriously about your next comments, what you are doing if you could, would probably get you kicked out of school
– TheGeneral
Nov 19 '18 at 4:28
@HuangLee i would think very seriously about your next comments, what you are doing if you could, would probably get you kicked out of school
– TheGeneral
Nov 19 '18 at 4:28
@TheGeneral lol, no. you could send request to use school system in a day or two. as long as it not hacking or stealing things
– Huang Lee
Nov 19 '18 at 4:36
@TheGeneral lol, no. you could send request to use school system in a day or two. as long as it not hacking or stealing things
– Huang Lee
Nov 19 '18 at 4:36
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f53368081%2fuse-all-100-power-of-cpu-with-c-sharp%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
1
You're doing file I/O - there is your bottleneck. Throwing threads at it is not going to improve anything
– MickyD
Nov 19 '18 at 3:54
I just remove file I/O & run it. It's pretty much the same performance :v
– Huang Lee
Nov 19 '18 at 3:57
2
As MickyD says it, this is not a CPU bound operation but a Disk bound one. If anything throwing more threads at it will add Thread management overhead, making it slower. | As for properly replicating Vanitygen: I doubt that will happen. It is written in C, wich allows all the Micro--optimsiations moderns day programmers do not deal with. .NET is in no way noticeably slwoer in common use cases, but that programm is a high performance BitCoin miner (I think, the description is wierd).
– Christopher
Nov 19 '18 at 3:58
1
I also noticed you got WriteLines in there. Writing to the user is expensive. If you only do it once per user triggered event, you will not notice. But from a loop, the speed of consoel drawing can easily become the bottleneck. Try just minimizing the Console window and see if the performance improoves. I run my fair share of console commands monthly, and if hte processing is short the Console overhead becoems massive.
– Christopher
Nov 19 '18 at 4:00
1
You're also writing to the same file from multiple threads... that's a recipe for disaster.
– Sunius
Nov 19 '18 at 4:03