Lattice Multiplication with threads, is it more efficient?
which one is faster: Using Lattice Multiplication with threads(big numbers) OR Using common Multiplication with threads(big numbers)
Do you know any source code, to test them?
------开发者_开发知识库-----------EDIT------------------ The theads should be implemented in C, or Java for testing
If I understand you correctly, "lattice multiplication" is different way of doing base-10 multiplication by hand that is supposed to be easier for kids to understand than the classic way. I assume "common multiplication" is the classic way.
So really, I think that the best answer is:
Neither "lattice multiplication" or "common multiplication" are good (efficient) ways of doing multiplication on a computer. For small numbers (up to 2**64), built-in hardware multiplication is better. For large numbers, you are best of breaking the numbers into 8 or 32 bit chunks ...
Multi-threading is unlikely to speed up multiplication unless you have very large numbers. The inherent cost of creating (or recycling) a thread is likely to swamp any theoretical speedup for smaller numbers. And for larger numbers (and larger numbers of threads) you need to worry about the bandwidth of copying the data around.
Note there is a bit of material around on parallel multiplication (Google), but it is mostly in the academic literature ... which maybe says something about how practical it really is for the kind of hardware used today for low and high end computing.
精彩评论