1

I am watching many videos and reading some articles on RISC and CISC architectures and Computer Architecture in general.

To my limited understanding, one major difference between RISC and CISC is:

each RISC instruction roughly translates to a single operation that the CPU can perform.

Knowing this; and other RISC specific features: what design decisions should an Android developer consider that are different from traditional Java development?

For example:

Let's say I want to multi-thread syntax highlighting on the users' search terms on a List of results.

One idea is to have a pool of size Runtime.getRuntime().availableProcessors() and each task in the pool work on an individual element in the array.

I can use an OrderedSet to maintain order, by making each element in the list an object which implements Comparable and provide some sorting in compareTo

I am not an expert so I can't really say that this is a good solution for this problem on a CISC CPU or some AWS EC2 instance.

I am also trying to improve my understanding, so would this still be a good design on a RISC processor? If not, why not? What is a better design decision?

What are some decisions to consider for RISC specific code that help improve the functionality by improving performance? Or has the new ARMv7 too similar CISC making all this moot?

Jonas
  • 121,568
  • 97
  • 310
  • 388
Sam Hammamy
  • 10,819
  • 10
  • 56
  • 94
  • You don't try to optimize your code unless you have done some testing and found bottle knecks. – Trash Can Nov 22 '17 at 20:39
  • 1
    read http://wiki.c2.com/?PrematureOptimization – Diego Torres Milano Nov 22 '17 at 20:58
  • @DiegoTorresMilano I agree with what you are saying in spirit, but I do have this code that is currently slowly loading a View. So I have a need to optimize. Maybe not in terms of CPU and rather in terms of algorithm, but I do have a need. Since I have that need it is good to look at all options – Sam Hammamy Nov 22 '17 at 21:55
  • 1
    dont get worked up about CISC and RISC and von neumann and harvard and other terms you may read. the line between CISC and RISC is a bit blurry. You should clearly see that CISC does multiple things per operation from a high level you can perform operations with memory operands for example in x86. add some memory location, some value. which means the memory location has to be read, the math done then the memory location done. think of that is a read, an add and an write, three high level operations. – old_timer Nov 25 '17 at 12:46
  • 1
    a RISCy view of that is perform a load, possibly move an immediate value into another register, do the add, then store the result out, taking multiple instructions, but instructions that flow through the processor much faster with much less logic. just like computers use binary based gates rather than base 10 logic with 10 states per signal. takes more gates but is so much more efficient (and accurate) that it makes sense. CISCs have traditionally been microcoded in some way (there is another processor inside that is more risc like or even simpler) for various reasons. – old_timer Nov 25 '17 at 12:48
  • 1
    at the end of the day though you are so far removed from most of this and you are trying to hard to make a connection that you fall into the pre-optmization. doesnt mean you cant write your code to be more efficient and perform better, but you are just scratching the surface on this and need to do more research in particular compiling and disassembling to see what the tools are doing to your code as you change it. – old_timer Nov 25 '17 at 12:50
  • 1
    JAVA is an abstraction it is its own instruction set that is interpreted by a virtual machine at runtime. (can be compiled to the target but often isnt). So kinda by definition it is inefficient and slow. but that is not the purpose the purpose was portability. Write one program compile it to the virtual machine instruction set, and run everywhere, windows, mac, linux, etc. – old_timer Nov 25 '17 at 12:51

0 Answers0