Sign in to follow this  
timmy2

prefetch memory in java

Recommended Posts

Hi I am looking for a fanction in java 5 that will prefatch a selected object, does anyone knows such function? Thanks

Share this post


Link to post
Share on other sites
The compiler will try to do this for you when it's worth the bother.

But Java is a high-level language, meaning that stuff like this is abstracted away, so you're supposed to just let the compiler/CPU deal with stuff like this. [wink]

The only thing you can do is like Fred304 suggested, to use the object. Then it has to be loaded into CPU cache, and it's effectively "prefetched".

Share this post


Link to post
Share on other sites
Java doesn't have functions. Java has only methods.
I asume you don't know the correct term, because prefetch is often used in a meaning tell CPU to async grab something from memory that would be used 15 cycles later.

Assembly commands are outlawed in Java.

Share this post


Link to post
Share on other sites
thanks all
I assumed that java don't have this abilty, you can find such abilty in C++,
by the way java compiler does the optimization only after it's check which method took the longest.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this