<blockquote>
  <p>For Litecoin, if memory size is increased in processing the Scrypt
  algorithm, for example to 384 kB instead of 128 kB (...), would the typical CPU
  architecture (...) be likely to see a corresponding increase
  in performance?</p>
</blockquote>

<p>No, it works the opposite. If you increase memory, which is used by the scrypt to generate a single hash, the time it takes to generate it, in theory, will increase. The time may not increase if the processing unit can fully use its fastest cash in a single data transfer call. However, you need standardised hardware and you would want to deliberately adjust scrypt memory size for it. Which is inconvenient on a global users scale.</p>

<p>Moreover, it's not up to you, personally, to decide the memory size of scrypt. This is a universal agreement of all litecoin users, that memory size of the scrypt algorithm has to be <em>N</em> bytes. If you want to use something else, any transaction you issue will never gets validated by any other users. </p>

CC BY-SA 3.0
2014-01-29T11:48:08.247Z
2014-01-29T11:48:08.247Z
oleksii
<p>No. increase the block size to 384KB does not help scrypt algorithm. Litecoin with scrypt parameters N=1024, R=P=1, that only requires 128KB memory space for single one compuation. And they are already fully aligned, not sparse array. Modeling small data in larger memory space means poor locality.</p>

<p>The key to speedup scrypt is parallelism, because the mining process is to find a valid nonce among the very large solution space. So if the memory is the bottleneck, CPU needs to wait for the completion of memory read/write operations before continue current hashing computation, but in fact, CPU's ALU (or compute units) can keep going and executing other instructions of other hashing computation threads which do not require memory access or whose data has ready now. That's the key to introduce SIMD. So CPU AVX performance is better than SSE/MMX, and newer AVX-2 can achieve better performance.</p>

<p>In GPU, there are many computation units, it does not like CPU only has 2/4/8/... cores. GPU has many streaming processors and scheduling hardware. When a computation is waiting for the completion of GDDR VRAM access, it can schedule the ALU hardware to do other computations.</p>

<p>In fact, current GPU mining has the best memory block size configuration per one scrypt hashing, the lookup-gap is 2. It means only 64KB per one scrypt operation. Because in CPU or GPU, accessing the global memory is very expansive, and scrypt does not have fully linear memory access pattern. (it accesses vectorized data among index 1 to 1024 randomly). So fewer memory access can also speedup the total computation time, but the overhead is that GPU needs to compute data that did not save to memory before.
For example, GPU computes vectorized data from 1 to 1024, but only saves 1,3,5,7,... So when scrypt algorithm needs data of index=4, GPU needs to retrieve data of index=3 and re-compute to gain the data for index=4. But the computation for index=4 in private memory (GPRs, General Purpose Registers, GPU has plenty of them) is very fast.
But the performance does not always get improved by increasing the look-up gap. Although the memory access are significantly reduced, but GPU needs to do redundant job to re-compute the data frequently. For example, when look-up gap = 3, GPU only saves 1,4,7,... But when scrypt needs data of index=6, it needs to retrieve data of index=4 and do the computation twice.</p>

CC BY-SA 3.0
2014-02-05T09:41:56.940Z
2014-02-05T09:41:56.940Z
jclin
<p>I believe that most people should try out mining, and then really think about why you are mining.  Curious?  Fun?  Money?  Do you believe in the cryptocurrency?   </p>

<p>Personally I think that crytocurrencies are here to stay. Litecoin is second behind Bitcoin, but mining it can be super profitable if the price of what you mined shoots up like Bitcoin.  This stuff is like gold.  No government can de-value it by printing more paper money and diluted its value.  This fits the very description of a good currency.</p>

<p>What if litecoin goes from under 30 a coin to 800 a coin?  You don't care about the $6 /day in electricity that you had previous spent now do you?</p>

CC BY-SA 3.0
2014-01-29T01:16:27.843Z
2014-01-29T01:16:27.843Z
Tom Stickel
<p>For Litecoin, if memory size is increased in processing the Scrypt algorithm, for example to 384 kB instead of 128 kB (and assuming likewise an L2 cache size of 384 kB), would the typical CPU architecture (x86, PPC, etc) be likely to see a corresponding increase in performance?  And if increased memory size were used, would mining output remain 100% compatible with Litecoin (I believe the answer is yes, but also I note that almost all GPU miners are using fixed Scrypt parameters for N, r, and p).</p>

<p>I realize that increasing BlockMix memory sizee is not typically done on GPU architectures, for various reasons.  Also as a note my objective is not profitable Litecoin x86 CPU mining -- I just want to be sure I understand the  memory/performance tradeoff.</p>

<altcoin><mining-hardware><gpu><scrypt><cpu>
Scrypt (Litecoin) memory / performance tradeoff
Jeff Brower
# Scrypt (Litecoin) memory / performance tradeoff

(Asked by: username_0 on 2014-01-27)

For Litecoin, if memory size is increased in processing the Scrypt algorithm, for example to 384 kB instead of 128 kB (and assuming likewise an L2 cache size of 384 kB), would the typical CPU architecture (x86, PPC, etc) be likely to see a corresponding increase in performance? And if increased memory size were used, would mining output remain 100% compatible with Litecoin (I believe the answer is yes, but also I note that almost all GPU miners are using fixed Scrypt parameters for N, r, and p).

I realize that increasing BlockMix memory sizee is not typically done on GPU architectures, for various reasons. Also as a note my objective is not profitable Litecoin x86 CPU mining -- I just want to be sure I understand the memory/performance tradeoff.

**Tags:** altcoin, mining-hardware, gpu, scrypt, cpu


---

## 3 answers

### Answer by username_1 on 2014-01-29. Score: 3

> For Litecoin, if memory size is increased in processing the Scrypt
> algorithm, for example to 384 kB instead of 128 kB (...), would the typical CPU
> architecture (...) be likely to see a corresponding increase
> in performance?

No, it works the opposite. If you increase memory, which is used by the scrypt to generate a single hash, the time it takes to generate it, in theory, will increase. The time may not increase if the processing unit can fully use its fastest cash in a single data transfer call. However, you need standardised hardware and you would want to deliberately adjust scrypt memory size for it. Which is inconvenient on a global users scale.

Moreover, it's not up to you, personally, to decide the memory size of scrypt. This is a universal agreement of all litecoin users, that memory size of the scrypt algorithm has to be *N* bytes. If you want to use something else, any transaction you issue will never gets validated by any other users.


---

### Answer by username_2 on 2014-02-05. Score: 0

No. increase the block size to 384KB does not help scrypt algorithm. Litecoin with scrypt parameters N=1024, R=P=1, that only requires 128KB memory space for single one compuation. And they are already fully aligned, not sparse array. Modeling small data in larger memory space means poor locality.

The key to speedup scrypt is parallelism, because the mining process is to find a valid nonce among the very large solution space. So if the memory is the bottleneck, CPU needs to wait for the completion of memory read/write operations before continue current hashing computation, but in fact, CPU's ALU (or compute units) can keep going and executing other instructions of other hashing computation threads which do not require memory access or whose data has ready now. That's the key to introduce SIMD. So CPU AVX performance is better than SSE/MMX, and newer AVX-2 can achieve better performance.

In GPU, there are many computation units, it does not like CPU only has 2/4/8/... cores. GPU has many streaming processors and scheduling hardware. When a computation is waiting for the completion of GDDR VRAM access, it can schedule the ALU hardware to do other computations.

In fact, current GPU mining has the best memory block size configuration per one scrypt hashing, the lookup-gap is 2. It means only 64KB per one scrypt operation. Because in CPU or GPU, accessing the global memory is very expansive, and scrypt does not have fully linear memory access pattern. (it accesses vectorized data among index 1 to 1024 randomly). So fewer memory access can also speedup the total computation time, but the overhead is that GPU needs to compute data that did not save to memory before.
For example, GPU computes vectorized data from 1 to 1024, but only saves 1,3,5,7,... So when scrypt algorithm needs data of index=4, GPU needs to retrieve data of index=3 and re-compute to gain the data for index=4. But the computation for index=4 in private memory (GPRs, General Purpose Registers, GPU has plenty of them) is very fast.
But the performance does not always get improved by increasing the look-up gap. Although the memory access are significantly reduced, but GPU needs to do redundant job to re-compute the data frequently. For example, when look-up gap = 3, GPU only saves 1,4,7,... But when scrypt needs data of index=6, it needs to retrieve data of index=4 and do the computation twice.


---

### Answer by username_3 on 2014-01-29. Score: -1

I believe that most people should try out mining, and then really think about why you are mining. Curious? Fun? Money? Do you believe in the cryptocurrency?

Personally I think that crytocurrencies are here to stay. Litecoin is second behind Bitcoin, but mining it can be super profitable if the price of what you mined shoots up like Bitcoin. This stuff is like gold. No government can de-value it by printing more paper money and diluted its value. This fits the very description of a good currency.

What if litecoin goes from under 30 a coin to 800 a coin? You don't care about the $6 /day in electricity that you had previous spent now do you?


---

