Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror

Slashdot videos: Now with more Slashdot!

  • View

  • Discuss

  • Share

We've improved Slashdot's video section; now you can view our video interviews, product close-ups and site visits with all the usual Slashdot options to comment, share, etc. No more walled garden! It's a work in progress -- we hope you'll check it out (Learn more about the recent updates).

×

Comment: Re:Check their work or check the summary? (Score 1) 486

by jfbilodeau (#49338957) Attached to: No, It's Not Always Quicker To Do Things In Memory
OMG C is SOOOooOO slow compared to my l33t Java code! In the spirit of the fine paper related to this article, here's a 100% fair, unbiased comparison of both languages.
[code lang="c"]
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>

int main(int argc, char** argv) {
    const char* appendString = "1";

    char* concatString = (char*)malloc(1);
    concatString[0] = 0;

    int numIter = 100000;

    clock_t startTime, endTime;

    startTime = clock();

    for (int i = 0; i < numIter; i++) {
        char* tempString = (char*)malloc(strlen(concatString) + strlen(appendString) + 1);
        strcpy(tempString, concatString);
        strcat(tempString, appendString);
        free(concatString);
        concatString = tempString;
    }

    endTime = clock();

    double totalTime = (double)(endTime - startTime) / CLOCKS_PER_SEC;
    printf("Operation took %f seconds", totalTime);
    return EXIT_SUCCESS;
}
[/code]

[code lang="java"]
public class Crap {
    public static void main(String[] args) {
        String appendString = "1";
        String concatString = "";

        int numIter = 100000;

        long startTime, endTime;

        startTime = System.currentTimeMillis();

        StringBuilder builder = new StringBuilder();

        for (int i = 0; i < numIter; i++) {
            builder.append(appendString);
        }

        concatString = builder.toString();
        endTime = System.currentTimeMillis();
        double totalTime = (double)(endTime - startTime) / 1000;

        System.out.printf("Operation took %f seconds\n", totalTime);

    }
}
[/code]

[code lang="term"]
$ cc -O3 crap.c -o crap
$ ./crap
Operation took 0.749926 seconds
$ javac Crap.java
$ java Crap
Operation took 0,009000 seconds
[/code]

Look how FATSTER JAVA is compared to C!!!!1!! You should be ashamed of using such a sloow programming language like C!

Comment: Re:Like everything else M$... (Score 1) 208

by jfbilodeau (#49173111) Attached to: What Would Minecraft 2 Look Like Under Microsoft?

Minecraft isn't all that good of a game

You seem to be confusing "I don't like that game" with "it's not a good game". I suspect that more copies of Minecraft were sold than Neverhood, Age of Empires series , Starlancer/Freelancer series, Midtown Madness series, Mechwarrior 4 and Flight Simulator combined.

"Go to Heaven for the climate, Hell for the company." -- Mark Twain

Working...