IRC Networks
Irc Logs Stats
Start date: 2007-09-27 02:48:27
Last update: 2008-10-24 20:19:38
Channels: 41
Logged Lines: 6230436
Size: 1822.27 MB
Powered by
Channel Info
Network: freenodeChannel: #csharp |
Search in www.irclog.org
Log from #csharp at freenode 2006-06-17
[12:08]<wyfaj`>adding 1million integers to an arraylist
[12:08]<wyfaj`>nah, c#
[12:08]<edjg>ah
[12:08]<edjg>try Java
[12:08]<wyfaj`>it wont be any different in java
[12:08]<vxznrm_>i'll try java
[12:08]<edjg>maybe java is secretly faster than native ;)
[12:08]<vxznrm_>lol yea
[12:08]<edjg>of course the timer class could be funny, but who knows
[12:08]<wyfaj`>heh
[12:08]<edjg>there's no way it should miss 100 ms though
[12:09]<vxznrm_>let see how it does on my 1,2ghz
[12:09]<vxznrm_>:P
[12:09]<edjg>long start = System.currentTimeMillis(); // big loop long stop = System.currentTimeMillis(); System.out.println(stop - start);
[12:09]<wyfaj`>heh
[12:10]<wyfaj`>doesnt currentTimeMillis basically overflow?
[12:10]<wyfaj`>for example after 1 second it returns 0 again or somethin
[12:11]<vxznrm_>Emon, what kinda loop did you do?
[12:11]<edjg>No, I've done tests where it returns over 30 seconds
[12:11]<edjg>I think I tried a foreach and a regular for
[12:11]<wyfaj`>al = new arraylist(); stopwatch.Start(); for (int i = 0; i < 1000000; i++) al.Add(i); stopwatch.Stop();
[12:12]<vxznrm_>~3secs
[12:12]<edjg>let me try the java again
[12:13]<vxznrm_>with java here
[12:13]<wyfaj`>3 secs?!
[12:13]<wyfaj`>thats not possible either :P
[12:13]<vxznrm_>hehe yea
[12:13]<wyfaj`>are you sure you didnt type 1 0 too much?
[12:13]<edjg>on a 1.2 ghz machine?
[12:13]<vxznrm_>hosted it in an applet
[12:13]<wyfaj`>oh well.. maybe
[12:13]<edjg>In Java?
[12:13]<edjg>oh geez
[12:13]<edjg>It's probably not even doing any JIT
[12:13]<wyfaj`>um, java should be plenty fast.
[12:14]<vxznrm_>yup
[12:14]<vxznrm_>i'll try .net console
[12:14]<edjg>I don't know if Java applets are JIT compiled. Java applications are. And if you have a server VM, they'll be even more optimized with the -server switch (e.g. java -server myclass)
[12:16]<vxznrm_>~0.5secs
[12:16]<vxznrm_>with c#
[12:16]<wyfaj`>weird
[12:16]<wyfaj`>oh well.
[12:17]<edjg>hmm weird
[12:17]<edjg>I get 765 now
[12:17]<edjg>I must have done something stupid like start - stop last time
[12:17]<wyfaj`>:P
[12:17]<edjg>nah not even, I would have just gotten negative
[12:17]<edjg>shrug
[12:18]<edjg>I just got 688...that's with the array's initial capacity at 0. That means it's reallocating the entire array one million times :/
[12:18]<edjg>because, IIRC, ArrayList doesn't have any load factoring like vector
[12:18]<wyfaj`>um. no
[12:18]<edjg>no?
[12:18]<wyfaj`>it wont reallocate it 1 million times
[12:18]<wyfaj`>it'll double + 1 or something
[12:18]<edjg>really
[12:19]<edjg>ok then
[12:19]<wyfaj`>one would hope so. at least thats what arraylist in .net does
[12:19]<wyfaj`>and other collection types
[12:19]<wyfaj`>reallocating with a size of +1 is silly.
[12:19]<edjg>well I know the Vector class does load factoring like that, I wasn't sure about ArrayList
[12:19]<edjg>hey, don't look at me
[12:19]<wyfaj`>:P
[12:19]<edjg>:P
[12:20]<vxznrm_>right
[12:20]<vxznrm_>enough of this
[12:20]<vxznrm_>gonna bike to town
[12:20]<vxznrm_>later
[12:20]<edjg>later
[12:20]<vxznrm_>speed testing on a 1,2ghz box just makes you sad
[12:21]<edjg>With a starting capacity of 0, it takes, on average, 550 ms. With a starting capacity of 1,000,000, it takes about 480-500 on average. Just judging by that, one can assume that ArrayList has some sensible load factoring.
[12:21]<wyfaj`>:)
[12:22]<edjg>that's pretty good though, for java
[12:22]<edjg>of course it is not a comprehensive speed test :P
[12:22]<edjg>oh god
[12:23]<edjg>+ 1 load factor for(int i = 0; i < 1000000; i++) {
[12:23]<edjg> Integer[] list = new Integer[i];
[12:23]<edjg> for(int k = 0; k < i; k++) {
[12:23]<edjg> list[k] = new Integer(i);
[12:23]<edjg> }
[12:23]<edjg> }
[12:23]<edjg>It's still running :/
[12:23]<wyfaj`>well obviously...
[12:23]<vxznrm_>was can you expect
[12:23]<vxznrm_>that there is pretty extensive :)
[12:23]<edjg>well yeah
[12:23]<edjg>but I can't say I ever tried it before :P
[12:24]<edjg>that's what, O(n!)
[12:24]<edjg>or is it !n
[12:24]<cjfmfusyjg>hehe what have you come up with for a result with c# vs java on the arraylists populated with ints?
[12:24]<edjg>I cannot remember
[12:24]<edjg>heh I didn't try C#
[12:24]<edjg>I would expect it to be a little faster
[12:25]<edjg>I'm gonna get back to my ASP.NET problem though :P
[12:26]<edjg>yay it works
[12:26]<edjg>well the code is broken but at least asp.net runs
[12:27]<edjg>..or not
[12:29]<edjg>" The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request." what's that mean?
[12:30]<wyfaj`>that you fucked something up
[12:30]<wyfaj`>;)
[12:30]<edjg>:/







