It's so slow!



  • My thesis at WTFU consists of improving and enhancing some sort of agent-based simulator. I'm not very knowledgeable about the scientific model, and I'm not supposed to - it's basically a "we got this shit, and it ain't working too well - fix it, and we'll push it somehow" matter.

    The main complaint was that the application is slow. Uni people blamed everything on the drawing code - a justified call, given it's drawing thousands of agents per step on a managed C# bitmap, and then putting it into a Windows Forms' PictureBox.

    So, I get the SVN data, grab the code and take a peek. It looks like someone just got their brand new book on programming patterns, but it's okay - so, time for a test run. Build, run, start...

    ...and it's fast. Not lightning fast, but manageable - it takes about ten to twenty seconds to finish a simulation, instead of way over a minute. I put the blame on having a fast PC, mark as COULD_NOT_REPRODUCE and go on to the next work item.

    I finish up a minor tweak, and run the code again. And now it's slow as molasses. What the fuck? I grab the profiler, run a simulation to the end, and check the results. And, lo and behold, I find this tiny bit of code:

    Debug.Assert(!Agents.Any((a) => a.ID == secondAgent.ID && a != secondAgent));
    

    Yup. For each of several thousands of agents, in each step of simulation, the program does a few simple calculations, and then meticulously browses the whole list looking for impossible. According to the profiler, this one line of a four-project, tens-of-thousands-LOC solution took about 75% of execution time.

    And yup, the program that has allegedly been presented on scientific conferences, had papers written based on it, and was generally a well-used academic research tool has been compiled in Debug mode all the time.



  • I think you have a speed-up loop scenario here. If only you could get paid for the massive performance improvement (just don't let them know all you did was compile in Release mode).



  • @Maciejasjmj said:

    And yup, the program that has allegedly been presented on scientific conferences, had papers written based on it, and was generally a well-used academic research tool has been compiled in Debug mode all the time.

    This sounds exactly like my experiences with academics, the theory's great but usually doesn't quite hold up when applied to reality



  • The solution, of course, is to find a way to make this incrementally faster, so that you can take credit for speeding it up multiple times.


  • Discourse touched me in a no-no place

    @chubertdev said:

    The solution, of course, is to find a way to make this incrementally faster, so that you can take credit for speeding it up multiple times.

    The easiest approach is to pick a random number from 0…1, and only run the assert if the number is over 0.5…



  • @Arantor said:

    This sounds exactly like my experiences with academics, the theory's great but usually doesn't quite hold up when applied to reality

    Except reality would theoretically should be 'compiled in release mode'



  • @Matches said:

    Except reality would theoretically should be

    wat



  • THEORETICS BEN! THIS IS ACADEMIA! GET WITH IT!



  • Original text:

    "Except reality would theoretically should be "

    ...35 translations later, Bing gives us:

    "But I don't want anything."



  • @Matches said:

    THIS IS WHAT YOU LEARN IN SCHOOL YOU DOUCHECANOE!!

    BTFY



  • I'm proud you went the extra mile to find true meaning.

    But you didn't show your work. So no points.



  • @Matches said:

    show your work

    From English: Except reality would theoretically should be 
    To Bulgarian: Освен реалност би теоретично трябва да бъде 
    Back to English: But reality would theoretically need to be 
    To Catalan: Però la realitat Teòricament hauria d'estar 
    Back to English: But the reality Theoretically should be 
    To Chinese Simplified: 但现实理论上应该是
    Back to English: But it should theoretically be
    To Chinese Traditional: 但它從理論上講應該是
    Back to English: But it should theoretically be
    To Czech: Ale to by mělo být teoreticky
    Back to English: But it should theoretically be
    To Danish: Men det teoretisk burde være
    Back to English: But it theoretically should be
    To Dutch: Maar het theoretisch moet
    Back to English: But it theoretically should
    To Estonian: Aga teoreetiliselt peaks
    Back to English: But, in theory, should
    To Finnish: Mutta periaatteessa pitäisi
    Back to English: But, in principle, should be
    To French: Mais, en principe, devrait être
    Back to English: But, in principle, should be
    To German: Aber im Prinzip sollte man
    Back to English: But in principle, you should
    To Greek: Αλλά σε γενικές γραμμές, θα πρέπει να
    Back to English: But in General, you should
    To Haitian Creole: Men, an jeneral, ou ta dwe
    Back to English: But in General, you should
    To Hebrew: אבל באופן כללי, את צריכה לספר
    Back to English: But in General, you need to tell
    To Hungarian: De általában meg kell mondani
    Back to English: But generally you have to say
    To Indonesian: Tetapi umumnya Anda harus mengatakan
    Back to English: But generally you have to say
    To Italian: Ma in generale si deve dire
    Back to English: But in general it should say
    To Japanese: しかし、一般的に言う必要があります。
    Back to English: But must say generally.
    To Korean: 하지만 일반적으로 말을 해야 합니다.
    Back to English: But in General, I must say.
    To Latvian: Bet vispār, man jāteic.
    Back to English: But in General, I must say.
    To Lithuanian: Bet apskritai, aš turiu pasakyti.
    Back to English: But overall, I have to say.
    To Norwegian: Men alt jeg har å si.
    Back to English: But all I have to say.
    To Polish: Ale wszystko co mam do powiedzenia.
    Back to English: But all I have to say.
    To Portuguese: Mas tudo o que tenho a dizer.
    Back to English: But all I have to say.
    To Romanian: Dar tot ce am de spus.
    Back to English: But all I got to say.
    To Russian: Но все я получил бы сказать.
    Back to English: But all I got to say.
    To Slovak: Ale všetko, čo mám povedať.
    Back to English: But all I have to say.
    To Slovenian: Ampak vse, kar imam za povedati.
    Back to English: But all I have to say.
    To Spanish: Pero todo lo que tengo que decir.
    Back to English: But all I have to say.
    To Swedish: Men allt jag har att säga.
    Back to English: But all I have to say.
    To Thai: แต่ทั้งหมดไม่ต้องการ
    Back to English: But all do not want to.
    To Turkish: Ama tüm istemiyorum.
    Back to English: But I don't want all of.
    To Ukranian: Але я не хочу все.
    Back to English: But I don't want anything.
    To Vietnamese: Nhưng tôi không muốn bất cứ điều gì.
    Back to English: But I don't want anything.
    


  • Thai is really messing that up.


  • BINNED

    It's ok. It's just the translator becoming self-conscious.



  • @Onyx said:

    self-conscious.

    TRANSLATOR: oh.. oh my I'm sorry I guess I did that heh *blush*


  • BINNED

    @dhromed said:

    TRANSLATOR: oh.. oh my I'm sorry I guess I did that heh blush

    And that's what happens when I translate shit. I mean aware, but freaking languages don't map to each other properly sometimes.


Log in to reply