Experienta

Ce inseamna experienta … In esenta o poti reduce la capacitatea cuiva de a prezice viitorul si a-si lua masuri care sa ii minimizeze/maximizeze impactul ( functie de nevoia personala ). O poveste despre ce inseamna asta:

The Programming Antihero

I was fresh out of college, still wet behind the ears, and about to enter the beta phase of my first professional game project – a late-90s PC title. It had been an exciting rollercoaster ride, as projects often are. All the content was in and the game was looking good. There was one problem though: We were way over our memory budget.

Since most memory was taken up by models and textures, we worked with the artists to reduce the memory footprint of the game as much as possible. We scaled down images, decimated models, and compressed textures. Sometimes we did this with the support of the artists, and sometimes over their dead bodies.

We cut megabyte after megabyte, and after a few days of frantic activity, we reached a point where we felt there was nothing else we could do. Unless we cut some major content, there was no way we could free up any more memory. Exhausted, we evaluated our current memory usage. We were still 1.5 MB over the memory limit!

At this point one of the most experienced programmers in the team, one who had survived many years of development in the „good old days,” decided to take matters into his own hands. He called me into his office, and we set out upon what I imagined would be another exhausting session of freeing up memory.

Instead, he brought up a source file and pointed to this line:

static char buffer[1024*1024*2];
„See this?” he said. And then deleted it with a single keystroke. Done!

He probably saw the horror in my eyes, so he explained to me that he had put aside those two megabytes of memory early in the development cycle. He knew from experience that it was always impossible to cut content down to memory budgets, and that many projects had come close to failing because of it. So now, as a regular practice, he always put aside a nice block of memory to free up when it’s really needed.

He walked out of the office and announced he had reduced the memory footprint to within budget constraints – he was toasted as the hero of the project.

As horrified as I was back then about such a „barbaric” practice, I have to admit that I’m warming up to it. I haven’t gotten into the frame of mind where I can put it to use yet, but I can see how sometimes, when you’re up against the wall, having a bit of memory tucked away for a rainy day can really make a difference. Funny how time and experience changes everything.

De aici: Dirty Coding Tricks

Anunțuri
Acest articol a fost publicat în expertise, practice. Pune un semn de carte cu legătura permanentă.

4 răspunsuri la Experienta

  1. redover zice:

    Da. Educativ!:)

  2. mvcaraiman zice:

    da, buna treaba asta 🙂 am auzit de o practica similara : o firma avea buget alocat ptr. ‘performance improvement’. si ca sa nu vina baietii cu mina goala, in devel bagau oamenii timpii morti pe care-i scoteau mai tirziu .

    • redeu zice:

      Da .. sunt multe feluri de a arata expertiza dar in principiu se pot rezuma la a incerca sa minimizezi riscul potentialelor probleme viitoare si de a incerca sa maximizezi beneficiile potentialelor succese. Stiu pe unu (mai comenteaza pe aici) care e suficient de bun in treaba asta incat sa aiba respectul meu ;-).

  3. redover zice:

    Sa-ti traiasca expertiza…La multi ani!

Lasă un răspuns

Completează mai jos detaliile tale sau dă clic pe un icon pentru a te autentifica:

Logo WordPress.com

Comentezi folosind contul tău WordPress.com. Dezautentificare / Schimbă )

Poză Twitter

Comentezi folosind contul tău Twitter. Dezautentificare / Schimbă )

Fotografie Facebook

Comentezi folosind contul tău Facebook. Dezautentificare / Schimbă )

Fotografie Google+

Comentezi folosind contul tău Google+. Dezautentificare / Schimbă )

Conectare la %s