Search code examples
programming-languagesassemblygroovyjvm

Can I Make Use Of My CPU registers for my speed performance?


i know that accessing data from the Registers is very much faster than the memory access. Let us say in groovy, i have a code like this:

def anto = "Is this gets stored in register?"
println(anto)

If i need anto to be stored in the register for the performance consideration, how to do that? There is any way in programming languages to do this, mainly in Groovy? I guess in C language we can do this by using extern keyword, how about in Groovy?


Solution

  • If you want to use such low-level features, use assembler.

    Even in C, the "register" keyword is ignored by the compiler nowadays, since the compiler assigns variables to registers in most cases more efficient than a human can.