JOIN
Get Time
forums   
Search | Watch Thread  |  My Post History  |  My Watches  |  User Settings
View: Flat (newest first)  | Threaded  | Tree
Previous Thread  |  Next Thread
<< PREV    [ 1 2 ]
Re: memset ...! (response to post by d000hg) | Reply
Would Java's array[][][] be any different? In fact, vector's [] doesn't even do bounds-checking, so I assume it might even be faster...
Or am I wrong about what array is?
Re: memset ...! (response to post by aboyner) | Reply
Hard to say, really. On the one hand, Java will dependably let you know if you access an array out of bounds, on the other hand, a vector is really a wrapper for an array (so operator[] calls an actual function, unless it can be inlined).
Re: memset ...! (response to post by Kawigi) | Reply
Using vector's at() operator instead of operator[] will do bounds-checking and throw exceptions...

But my post above was the result of confusion; I had forgotten that Java arrays have fixed size. Clearly, this allows them to be more efficient. But Java being Java, I doubt if they are :-)
Re: memset ...! (response to post by aboyner) | Reply
;-)

On the subject of Java efficiency, I just noticed that SPOJ compiles C/C++ solutions with optimizations on (but I don't think they compile Java with optimizations).
Re: memset ...! (response to post by Kawigi) | Reply
And your Java solutions are faster than a lot of C/C++ solutions... Should we draw conclusions? No?
Re: memset ...! (response to post by darko_aleksic) | Reply
We should modify that to say "Some of my Java solutions are faster than a lot of C/C++ solutions." The other thing that kicks Java on SPOJ is that .25 seconds of JVM startup time, especially for 1-second problems. And I'll take this opportunity (again) to ask the problemsetter for PLHOP, if he's reading, to up the time limit to 2 seconds :-)
Re: memset ...! (response to post by Kawigi) | Reply
I agree, I shouldn't generalize like that... but it wasn't me that started with generalizations :)
Re: memset ...! (response to post by marian) | Reply
(int*)x
That's so C. You must mean:
reinterpret_cast<int*>(x)
But I think what you really want is either of these:
&x[0][0]
x[0]
*x


Edit: Wow, I just noticed how old this thread is.
Re: memset ...! (response to post by tomek) | Reply
I wonder how you managed to dig this thread ;-)

EDIT: My stupidily! I just thought this thread is in Algorithm forums. Obviously this is in an article related thread and when there is a post in this forum, other posts come up to fist page.
<< PREV    [ 1 2 ]

RSS