Impaler
Sr. Member
Offline
Activity: 826
Merit: 250
CryptoTalk.Org - Get Paid for every Post!
|
|
July 10, 2013, 09:22:36 PM |
|
malloc should be minimized by using a pool of reusable arrays, expand the pool as needed but never delete them or create them unessarily, this will be a huge improvement.
|
|
|
|
nullbitspectre1848
|
|
July 10, 2013, 09:27:14 PM |
|
I'm starting to get a little cheesed off. Where the heck is the dev on this one? Any chance of getting an optimized client so (regular) people can actually use this?
|
|
|
|
vinne81
|
|
July 10, 2013, 09:27:29 PM |
|
I'm starting to get a little cheesed off. Where the heck is the dev on this one? Any chance of getting an optimized client so (regular) people can actually use this?
+1
|
|
|
|
eule
|
|
July 10, 2013, 09:28:59 PM |
|
|
|
|
|
mustyoshi
|
|
July 10, 2013, 09:29:12 PM |
|
I'm starting to get a little cheesed off. Where the heck is the dev on this one? Any chance of getting an optimized client so (regular) people can actually use this?
+1 It wasn't that hard to optimize it by hand. Give C++ a try. It'll do you a lot more good than just making a quick speculative buck in the long run.
|
|
|
|
Mike270
|
|
July 10, 2013, 09:40:54 PM |
|
For the two for loop, i get that
[...]
i'm not sure of myself on this one
Should do, but comment out if (nBiTwinSeq < nChainLength) in the first for loop, as that was the idea of splitting the loop (don't need to check there as that loop only runs up to nChainLength). And add unsigned int nBiTwinSeq = 0; before the first loop Rest looks ok (testing something else right now so my code already looks different.... yeah I know, no versioning, but hey... I'm doing this for fun :-) )
|
|
|
|
nmersulypnem
|
|
July 10, 2013, 09:43:21 PM |
|
For the two for loop, i get that
[...]
i'm not sure of myself on this one
Should do, but comment out if (nBiTwinSeq < nChainLength) in the first for loop, as that was the idea of splitting the loop (don't need to check there as that loop only runs up to nChainLength). And add unsigned int nBiTwinSeq = 0; before the first loop Rest looks ok (testing something else right now so my code already looks different.... yeah I know, no versioning, but hey... I'm doing this for fun :-) ) compile error. Where am I noobing it...? unsigned int nBiTwinSeq = 0; for (; nBiTwinSeq < * nChainLength; nBiTwinSeq++) {
....
prime.cpp: In member function 'bool CSieveOfEratosthenes::Weave()': prime.cpp:532:27: error: invalid type argument of unary '*' (have 'unsigned int')
?? EDIT- never mind. Someone virtual punch me in the face....
|
|
|
|
LazyOtto
|
|
July 10, 2013, 09:46:11 PM |
|
compile error. Where am I noobing it...? unsigned int nBiTwinSeq = 0; for (; nBiTwinSeq < * nChainLength; nBiTwinSeq++) {
....
prime.cpp: In member function 'bool CSieveOfEratosthenes::Weave()': prime.cpp:532:27: error: invalid type argument of unary '*' (have 'unsigned int')
?? What do you think that asterisk is doing? -- edit I assume that "never mind" means you saw it after taking a short break.
|
|
|
|
Mike270
|
|
July 10, 2013, 09:47:41 PM |
|
What do you think that asterisk is doing?
Looking for Obelisk? :-)
|
|
|
|
LazyOtto
|
|
July 10, 2013, 09:49:44 PM |
|
What do you think that asterisk is doing?
Looking for Obelisk? :-) My guess is that it was the avatar of an imp which just strolled in to have some fun.
|
|
|
|
vingaard
Legendary
Offline
Activity: 1246
Merit: 1011
|
|
July 10, 2013, 09:51:15 PM |
|
One question...
I'm running the same wallet in two computers (in different places) and I just find a block... how can I know which computer has mined this block... I mean... the wallet I can see at the moment mark the block as mined, but I figured that the other wallet (in other place) will mark the same... so... How can I know which computer have found the block?
|
|
|
|
LazyOtto
|
|
July 10, 2013, 09:51:43 PM |
|
debug.log
|
|
|
|
Mike270
|
|
July 10, 2013, 09:59:08 PM |
|
One question...
I'm running the same wallet in two computers (in different places) and I just find a block... how can I know which computer has mined this block... I mean... the wallet I can see at the moment mark the block as mined, but I figured that the other wallet (in other place) will mark the same... so... How can I know which computer have found the block?
Look out for proof-of-work found in debug.log
|
|
|
|
drummerjdb666
|
|
July 10, 2013, 09:59:49 PM |
|
Ok, so I'm probably hurting my income, but sharing some hints for optimizations: A quick'n'dirty profiling run showed that we spend very much time in memory allocations, so I am trying to eliminate some of them.
-did the headerhash mod outlined earlier
-did the time limit on Weave() from Sunny King
-removed some printf's , especially printf("MineProbablePrimeChain() : new sieve (%u/%u) ready in %uus\n", psieve->GetCandidateCount(), nMaxSieveSize, (unsigned int) (GetTimeMicros() - nStart)); from prime.cpp since it's the only call to the rather expensive GetCandidateCount
-after creating vPrimes array in prime.cpp, store vPrimes.size() in a static variably and replace all calls to it with the variable
-in prime.cpp, PrimeTableGetNextPrime and PrimeTableGetPreviousPrime: Use upper_bound/lower_bound instead of linear search: // Get next prime number of p bool PrimeTableGetNextPrime(unsigned int& p) { std::vector<unsigned int>::iterator foundelement=upper_bound(vPrimes.begin(), vPrimes.end(),p); if (foundelement!=vPrimes.end()){ p=*foundelement; return true; } return false; }
// Get previous prime number of p bool PrimeTableGetPreviousPrime(unsigned int& p) { std::vector<unsigned int>::iterator foundelement=lower_bound(vPrimes.begin(), vPrimes.end(),p); if (foundelement!=vPrimes.end()){ p=*--foundelement; return true; } return false; }
- in prime.cpp, CSieveOfEratosthenes::Weave() : Split the for loop into two for loops, one going up to nChainLength, the other one going up to 2*nChainLength Thus, you can safe the first first if+for clause in the first loop and leave away the if, and leave the if+for completely away in the second loop. Also, if (((nBiTwinSeq & 1u) == 0)) ... if (((nBiTwinSeq & 1u) == 1u))
can be substituted by
if (((nBiTwinSeq & 1u) == 0)) .... else .....
-prime.h: Removed nSieveSize and replaced all occurrences with nMaxSieveSize. Removed nSieveSize from the initializer as it's become obsolete.
-prime.h: Changed < std::vector<bool> vfCompositeCunningham1; < std::vector<bool> vfCompositeCunningham2; < std::vector<bool> vfCompositeBiTwin; --- > bool vfCompositeCunningham1[1000000]; > bool vfCompositeCunningham2[1000000]; > bool vfCompositeBiTwin[1000000]; Thus, we should save on quite a few mallocs.
-prime.h: Removed nSieveSize and replaced all occurrences with nMaxSieveSize. Removed nSieveSize from the initializer as it's become obsolete.
-prime.h: Changed < std::vector<bool> vfCompositeCunningham1; < std::vector<bool> vfCompositeCunningham2; < std::vector<bool> vfCompositeBiTwin; --- > bool vfCompositeCunningham1[1000000]; > bool vfCompositeCunningham2[1000000]; > bool vfCompositeBiTwin[1000000]; Thus, we should save on quite a few mallocs.
Don't forget to initialize the array by adding the following below in place of the other initialization for (int i = 0; i<1000000; ++i){ vfCompositeCunningham1[i] = false; vfCompositeCunningham2[i] = false; vfCompositeBiTwin[i] = false; } I think it'd be ideal to use a 2D array with the three composite values stored sequentially in memory as single bits each
Probably should be a std::bitset datatype too
+1 Or somebody could not be a greedy dick! And at least show the noob that wants to attempt to help out ur network with more miners which files to add all this too.. or code to replace this with.. any explanation to a non coder how to implement.. Or hopefully I have found a dev in this community that is willing to have a young grasshopper!!! to the greedy people!? killurselvessry to be an ass but some of you coders are shitting on my big smile i had when i woke up today! and to think the people I am talking about... I have randomly spoken very positive about in different place in the coin community! psh!
|
|
|
|
gatra
|
|
July 10, 2013, 10:04:37 PM |
|
Hi gatra,
with those few blocks/day and primes/s being quite imprecise... I left optimizations in when they didn't appear to cause an immediately visible (~10min) deterioration in primes/s.
Hi I didn't try it for primecoin, but for other coin I used this: https://github.com/freewil/bitcoin-testnet-boxIt's just a script that allows you to run 2 instances against each other, so it works like a small network of 2 nodes. If you run the optimized against the standard wallet and have them mine for some time, the faster one should have mined more blocks. Also, using ints for the bool arrays adds only a couple of fast instructions: for example instead of doing vfCompositeBiTwin[nVariableMultiplier] = true; you would do vfCompositeBiTwin[nVariableMultiplier >> 5] |= 1 << (nVariableMultiplier & 0x1f ) for testing it's if( vfCompositeBiTwin[nVariableMultiplier >> 5] & (1 << (nVariableMultiplier & 0x1f )))
|
|
|
|
nmersulypnem
|
|
July 10, 2013, 10:08:34 PM |
|
Has anyone successfully compiled on Windows with UPNP? I notice my new optimized binary is much faster, but it seems so have a much worse network connection (and the binary is much smaller).
|
|
|
|
|
8bitPunk
Member
Offline
Activity: 70
Merit: 10
|
|
July 10, 2013, 10:30:31 PM |
|
Awesome, thanks Mike270 & shinkicker ! Tips to you both
|
BTC 18bPunkuginRBm1Xz9mcgj8mWJnHDAW5Th | Ł LTCgXEdyBdoQ9WdF6JHi7Pa2EWtzbDjG76 | Ψ ATEBiTLkLpAYeW5hQknUfSvnb7Abbgegku
|
|
|
drummerjdb666
|
|
July 10, 2013, 10:38:32 PM |
|
LoL! am I a shinkicker? I like kicker of balls and shins together!!! did he release a linux update though.. that doesn't involve need to add code to it?
|
|
|
|
shinkicker
|
|
July 10, 2013, 10:43:59 PM |
|
And if shinkicker's still awake he may provide a compiled windows client :-)
Just about When Sunny commits his code to the repo, I will build another (if I am still awake). Or you could pastebin your file and we could try that? Is this prime or main.cpp?
|
|
|
|
|