Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Jonnty
Aug 2, 2007

The enemy has become a flaming star!

taqueso posted:

They are going to have a lot of typing to do when the number of seconds in a minute changes. (Ya, I know it is generated by a script)

Hmm, I'm trying to rationalise this. Could this possibly be so they could change the internal representation to milliseconds or something other than an integer number of seconds? Perhaps for an embedded platform? I've no idea what the context is for this so maybe that's silly.

Adbot
ADBOT LOVES YOU

Juuu
Sep 3, 2007
Wasn't me.

Jonnty posted:

Hmm, I'm trying to rationalise this. Could this possibly be so they could change the internal representation to milliseconds or something other than an integer number of seconds? Perhaps for an embedded platform? I've no idea what the context is for this so maybe that's silly.

https://github.com/twitter/time_constants/blob/master/README explains it. It's for performance reasons... Seriously?

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Juuu posted:

https://github.com/twitter/time_constants/blob/master/README explains it. It's for performance reasons... Seriously?

Twitter has thousands of servers. Having constants loaded when the app loads instead of calculating times during actions saves them real money.

Zhentar
Sep 28, 2003

Brilliant Master Genius
The T_#_SECONDS appear stupid, but they only make up 101 lines out of 1208, and are presumably only there for symmetry with non-seconds definitions. T_7_DAYS on the other hand, is obviously more understandable than 25200, less error prone than 60*60*24*7, and faster than doing the math at runtime with a library, as justified in the README.

It is perhaps premature optimization (or maybe it was well justified from profiling!), but it's definitely not ':psyduck: what were they thinking?!'.

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Zhentar posted:

It is perhaps premature optimization (or maybe it was well justified from profiling!), but it's definitely not ':psyduck: what were they thinking?!'.

Ruby time stuff is notoriously slow, and I don't doubt that Twitter Engineering profiled it out.

Juuu
Sep 3, 2007
Wasn't me.

Zhentar posted:

The T_#_SECONDS appear stupid, but they only make up 101 lines out of 1208, and are presumably only there for symmetry with non-seconds definitions. T_7_DAYS on the other hand, is obviously more understandable than 25200, less error prone than 60*60*24*7, and faster than doing the math at runtime with a library, as justified in the README.

It is perhaps premature optimization (or maybe it was well justified from profiling!), but it's definitely not ':psyduck: what were they thinking?!'.

The benchmark compares the constants to a method that converts an integer to a Time object (or something, I'm not a Ruby/ActiveSupport expert) and then back to an integer representing seconds. I doubt the difference compared to a straightforward multiplication would be as significant.

Mr.Radar
Nov 5, 2005

You guys aren't going to believe this, but that guy is our games teacher.

Zhentar posted:

The T_#_SECONDS appear stupid, but they only make up 101 lines out of 1208, and are presumably only there for symmetry with non-seconds definitions. T_7_DAYS on the other hand, is obviously more understandable than 25200, less error prone than 60*60*24*7, and faster than doing the math at runtime with a library, as justified in the README.

It is perhaps premature optimization (or maybe it was well justified from profiling!), but it's definitely not ':psyduck: what were they thinking?!'.

They could done macros that calculated the seconds from given time periods, e.g.
code:
#define TIME_S(s) (s)
#define TIME_MS(m, s) TIME_S(60*(m)+(s))
#define TIME_HMS(h, m, s) TIME_MS(60*(h)+(m), (s))
#define TIME_DHMS(d, h, m, s) TIME_HMS(24*(d)+(h), (m), (s))
//Convenience macros
#define TIME_D(d) TIME_DHMS((d), 0, 0, 0)
#define TIME_H(h) TIME_HMS((h), 0, 0)
//etc..
Any compiler worth anything would be able to constant-fold those expressions down to literal numbers so there's no drawback in terms of performance and a large gain in flexibility.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



What happens when you let your marketing director hire his buddy to design new products? It's cool: he's a pro with if statements.

php:
<?
$valueAA=e($_GET['valueAA']);
$valueBB=e($_GET['valueBB']);

if ($valueAA==NULL OR $valueBB==NULL){
$a1900 ="selected='selected'";
$b2012 ="selected='selected'";


$valueAA ="1900";
$valueBB ="2012";
} 
elseif ($valueAA=="1900"){
$a1900 ="selected='selected'";
} 
elseif ($valueAA=="1971"){
$a1971 ="selected='selected'";
} 
elseif ($valueAA=="1972"){
$a1972 ="selected='selected'";
} 
//... snip
elseif ($valueAA=="2012"){
$a2012 ="selected='selected'";
}

//repeated for $valueBB
?>
No, he doesn't know how to write a loop, but he did made it End Of The World Compliant, which would be fine since we all know 2013 won't happen, except that these are vehicle model years and the 13s are coming out soon...

Luckily, the actual programmers are able to foist further development off onto a consulting company, so I don't have to fix this mess :3:

Look Around You
Jan 19, 2009

Mr.Radar posted:

They could done macros that calculated the seconds from given time periods, e.g.
code:
#define TIME_S(s) (s)
#define TIME_MS(m, s) TIME_S(60*(m)+(s))
#define TIME_HMS(h, m, s) TIME_MS(60*(h)+(m), (s))
#define TIME_DHMS(d, h, m, s) TIME_HMS(24*(d)+(h), (m), (s))
//Convenience macros
#define TIME_D(d) TIME_DHMS((d), 0, 0, 0)
#define TIME_H(h) TIME_HMS((h), 0, 0)
//etc..
Any compiler worth anything would be able to constant-fold those expressions down to literal numbers so there's no drawback in terms of performance and a large gain in flexibility.

I would like to know how they are going to a) use macros in a language which has none and b) rely on compilation optimization in a language which is not compiled.

(yes I know that the ruby interpreter could do this [and in fact probably does] but I don't know if that's good to rely on if you need the response time that they are apparently aiming for with this library)

Mr.Radar
Nov 5, 2005

You guys aren't going to believe this, but that guy is our games teacher.

Look Around You posted:

I would like to know how they are going to a) use macros in a language which has none and b) rely on compilation optimization in a language which is not compiled.

(yes I know that the ruby interpreter could do this [and in fact probably does] but I don't know if that's good to rely on if you need the response time that they are apparently aiming for with this library)

Oops. I got confused by Dicky B's post into thinking the original code was C.

Edit: of course, the answer is to preprocess their Ruby source code with the C preprocessor :pseudo:

Mr.Radar fucked around with this message at 20:40 on Feb 1, 2012

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Which would, of course, not work, because it's not like the C preprocessor does constant folding either (except to resolve #if conditions).

Mr.Radar
Nov 5, 2005

You guys aren't going to believe this, but that guy is our games teacher.

rjmccall posted:

Which would, of course, not work, because it's not like the C preprocessor does constant folding either (except to resolve #if conditions).

Hence the :pseudo: (well, and the fact that Ruby syntax is different enough from C syntax to make it unlikely that most ruby code could be preprocessed correctly if at all).

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Mr.Radar posted:

They could done macros that calculated the seconds from given time periods, e.g.
code:
#define TIME_S(s) (s)
#define TIME_MS(m, s) TIME_S(60*(m)+(s))
#define TIME_HMS(h, m, s) TIME_MS(60*(h)+(m), (s))
#define TIME_DHMS(d, h, m, s) TIME_HMS(24*(d)+(h), (m), (s))
//Convenience macros
#define TIME_D(d) TIME_DHMS((d), 0, 0, 0)
#define TIME_H(h) TIME_HMS((h), 0, 0)
//etc..
Any compiler worth anything would be able to constant-fold those expressions down to literal numbers so there's no drawback in terms of performance and a large gain in flexibility.

This presupposes that Fixnum's * method is pure and free of side-effects (it's not necessarily so), in addition to the aforementioned lack of a Ruby preprocessor or compiler.

dwazegek
Feb 11, 2005

WE CAN USE THIS :byodood:

Zhentar posted:

The T_#_SECONDS appear stupid, but they only make up 101 lines out of 1208, and are presumably only there for symmetry with non-seconds definitions. T_7_DAYS on the other hand, is obviously more understandable than 25200, less error prone than 60*60*24*7, and faster than doing the math at runtime with a library, as justified in the README.

It is perhaps premature optimization (or maybe it was well justified from profiling!), but it's definitely not ':psyduck: what were they thinking?!'.

Fair enough for seconds, minutes, hours, days and even weeks. But months and years?

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
Why the hell does Twitter need constants for both years and solar years?

edit: Skyrim's PC version was compiled without any compiler optimizations. A modder rewrote the x87 code to SSE2 and inlined a bunch of getters and got a boost of ~40% performance. Bethesda has now released a patch that, among other things, "Improved compiler optimization settings"

Malloc Voidstar fucked around with this message at 12:08 on Feb 2, 2012

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Aleksei Vasiliev posted:

Why the hell does Twitter need constants for both years and solar years?

edit: Skyrim's PC version was compiled without any compiler optimizations. A modder rewrote the x87 code to SSE2 and inlined a bunch of getters and got a boost of ~40% performance. Bethesda has now released a patch that, among other things, "Improved compiler optimization settings"

These are the same chucklefucks who evidently didn't understand what heap fragmentation was on release so you could put a performance counter on virtual bytes and just count the minutes until it hit 2 gb and then Skyrim would crash for some mysterious reason.

How much you want to bet that in this patch, they turned on full optimization instead of doing profiling and setting optimization pragmas in the methods that would benefit the most?

tef
May 30, 2004

-> some l-system crap ->
http://thexploit.com/secdev/critical-php-remote-vulnerability-introduced-in-fix-for-php-hashtable-collision-dos/ tee hee :ohdear:

Hughlander
May 11, 2005

hieronymus posted:

These are the same chucklefucks who evidently didn't understand what heap fragmentation was on release so you could put a performance counter on virtual bytes and just count the minutes until it hit 2 gb and then Skyrim would crash for some mysterious reason.

How much you want to bet that in this patch, they turned on full optimization instead of doing profiling and setting optimization pragmas in the methods that would benefit the most?

They shipped on the PS3. They know exactly what heap fragmentation is. When you have 256MB of system memory to work with it's impossible to release a multiplatform SKU without knowing all about heap fragmentation and doing everything possible to avoid it.

nielsm
Jun 1, 2009



Hughlander posted:

They shipped on the PS3. They know exactly what heap fragmentation is. When you have 256MB of system memory to work with it's impossible to release a multiplatform SKU without knowing all about heap fragmentation and doing everything possible to avoid it.

Or they had different people working on the PC version of the engine and the PS3 version, and they didn't really talk.

Zorro KingOfEngland
May 7, 2008

There are about 10 million electricity meters in Texas. My company keeps a database of these so we know which meter is tied to which address and some other bits of information.

I discovered that our process to update this list was:

1. Read one line from the csv file we download every month
2. Delete the record associated with the meter we just read
3. Insert the record for that meter from the file
4. Go to 1

Do this 10 million times and it takes about 30 hours.

I rewrote it in about an hour and got a 6000% speed increase :toot:

Zhentar
Sep 28, 2003

Brilliant Master Genius

nielsm posted:

Or they had different people working on the PC version of the engine and the PS3 version, and they didn't really talk.

Or maybe they just had a bug in the PC version? No, it must be damning proof of Bethesda's fundamental incompetence. Only they would have the balls to release software with flaws in it.

raminasi
Jan 25, 2005

a last drink with no ice
edit: you know, I'm going to retract this because I can't confirm it

raminasi fucked around with this message at 20:27 on Feb 2, 2012

Zombywuf
Mar 29, 2008

If only Bethesda hadn't released game after game that all have exactly the same kinds of bug in them (I've even fallen through the floor a few times in Skyrim so far), because if they had done that then people might be less inclined to poke fun at them.

I also heard rumours that the PS3 slowdown bug is due to disk fragmentation related issues.

vvvvvv
Flying bears are a new bug, complete lockups are an old one, the latter I've seen happen up to 4 times an hour.

Also, Ebay say to move CPU intensive operations like joins out of the DB http://www.addsimplicity.com/downloads/eBaySDForum2006-11-29.pdf (page 22). This is yet another reason to boycot Ebay.

Zombywuf fucked around with this message at 22:32 on Feb 2, 2012

pigdog
Apr 23, 2004

by Smythe
Yeah everyone like a good flying bear video, but for a game of such (indeed unprecedented) scale, Skyrim is remarkably low on bugs and doesn't have anything to do with this thread. I think I saw like 2-3 serious bugs in 140 hours of my playthrough.


For content, I had a task of fixing an order management system recently. Made by one of the biggest software houses in the region while at it. They put it together using the same component they'd usually use to display tables of 0-50 rows, nd of course their clients didn't bother to check how it would act if the number of rows were 100k+.

So every time the user opened the page, the system
1) read from the database into RAM every row of the orders table
2) read from the database into RAM every row of the products table
3) read from the database into RAM every row of the customers table
then happily combined, ordered and filtered them as nice Java lists. Repeat the same procedure every time the user clicked anything on the page. :suicide:

SixPabst
Oct 24, 2006

I'm sitting here rewriting a bunch of pages for a client for this internal web app that were originally written by their in-house "developer", Frank. The pages are just basic reporting pages but the HTML is probably the worst I've ever seen in my life.

For instance, Frank's method of displaying a simple label:

code:
<td class="cell">
                                    <table>
                                        <tr>
                                            <td>
                                            </td>
                                            <td>
                                                <asp:Label CssClass="" ID="label" runat="server" BackColor="" />
                                            </td>
                                            <td>
                                               
                                            </td>
                                        </tr>
                                    </table>
                                </td>
Formatting is how I found it. :suicide: This one page has about 2500 lines of HTML that look just like that. I'm thinking I can get it to under 200 by the time I'm done.

hobbesmaster
Jan 28, 2008

Zombywuf posted:

(I've even fallen through the floor a few times in Skyrim so far)

I'm pretty sure every 3d game has "this bug". Fell through the map in Operation Metro last night...

John Matrix
Apr 27, 2004

GREAT AMERICAN DIPLOMAT
I had the wonderful job of cleaning up someone else's mess. The whole system was terrible, but this one little snippet makes me laugh (ASP.NET C#):
code:
    private Boolean ProcessKnownErrors(EMS_Error ex)
    {
        if (ex.ErrorDescription.IndexOf("Maximum request length exceeded") > -1)
        {
            lblErrorText.Text = "Error: Maximum file upload length exceeded";
            lblLoggedText.Text = "";
            lblOptionalData.Text = "Resolution: Please upload a smaller file or ask the CRM administrator to increase the file upload size limit.";
            return true;
        }
        else
        { return false; }
    }
There's a lot to laugh at here, but what's great is that this is the only place errors get processed in the entire 20+ page system. Everything filters through this "handler".

Anyway, instead of "cleaning up" the solution, I Shift+Deleted it and started from scratch in MVC. My soul was cleansed.

Dicky B
Mar 23, 2004

mintskoal posted:

code:
<td class="cell">
                                    <table>
                                        <tr>
                                            <td>
                                            </td>
                                            <td>
                                                <asp:Label CssClass="" ID="label" runat="server" BackColor="" />
                                            </td>
                                            <td>
                                               
                                            </td>
                                        </tr>
                                    </table>
                                </td>
Frank is flipping you off.

Cabbages and VHS
Aug 25, 2004

Listen, I've been around a bit, you know, and I thought I'd seen some creepy things go on in the movie business, but I really have to say this is the most disgusting thing that's ever happened to me.
the last place I worked, we had a vendor:
*deliver a $1,000,000 app. As delivered it was an unholy mess of Drupal with Django piled on top of it. It could only service one request per second per XL AWS instance.

The company brass figured that this experience meant that this vendor now "really understood our process", and handed them another $1,000,000 contract.

They delivered another app. It was also an unholy mess of Drupal with Django piled on top of it. It also required one server per request per second.

They used a root-level process to parse cookies with a raw python eval().

They took some of the worst things they did which were obviously in violation of the coding best practices we had specified, and stuck them all in a file called "dragons.py", as in, here there be dragons.

They overrode python internals for no reason that they could explain or that we could discern.
--------

last week I used a <font> tag in a production app because I was too lazy to do CSS inside a JSP for a one line change. i r not gud webdev.

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.

sXe.spengler posted:

an unholy mess of Drupal with Django piled on top of it.

What? How is that even possible?

Impotence
Nov 8, 2010
Lipstick Apathy
I just found an old PHP script that used sqlite2.

The issue here wasn't sqlite2. It was remote access to it: the other end would exec("rm -rf /tmp/sqdb"); exec("wget -q -O /tmp/sqdb phpurl"); - which would send the entire database, run an insert, then send it back up in a cURL HTTP POST

:psyduck:

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

sXe.spengler posted:

$1,000,000 app

What kind of scope does a $1mil web app have? (serious Q)

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
More importantly, who do I need to fellate to get a contract like that?

baquerd
Jul 2, 2007

by FactsAreUseless
A 1 million dollar app is around 3 senior developers, 3 junior developers and a manger working for a year once you figure in total cost of employment and other operating costs and a 10% profit margin. You might be able to squeeze in another junior developer if you had everyone telecommute. Common infrastructure like art asset management, quality assurance (whoops), and hardware staff will inflate that bill further.

Tad Naff
Jul 8, 2004

I told you you'd be sorry buying an emoticon, but no, you were hung over. Well look at you now. It's not catching on at all!
:backtowork:

Sinestro posted:

What? How is that even possible?

Dunno, but I'm currently benignly supporting a server that runs some sort of Drupal/Django mix. So there's at least one more of them. The way the project is going, I'm sure it costs about $1M, but it sure as hell isn't going to make that much.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

baquerd posted:

A 1 million dollar app is around 3 senior developers, 3 junior developers and a manger working for a year once you figure in total cost of employment and other operating costs and a 10% profit margin. You might be able to squeeze in another junior developer if you had everyone telecommute. Common infrastructure like art asset management, quality assurance (whoops), and hardware staff will inflate that bill further.
I was going to object to the notion of 6 devs and a manager with no testers or designers, but on second thought that may not be all that uncommon for enterprise software.

baquerd
Jul 2, 2007

by FactsAreUseless

Plorkyeran posted:

I was going to object to the notion of 6 devs and a manager with no testers or designers, but on second thought that may not be all that uncommon for enterprise software.

Designers as in software architects or art type designers? Developers can totally learn to do the former without a separate person in that role, and some special few can do good graphical design (most, like me, should stay the gently caress away from anything more complicated than colored lines and dots).

evensevenone
May 12, 2001
Glass is a solid.

Zombywuf posted:

You're never going to sell me on that semicolon.

Would this make you feel better? The last thing is evaluated always returned. Statements are separated by semicolons. if you put a semicolon, and there is nothing after it, what is returned is the evaluation of nothing, which is nil.

Look Around You
Jan 19, 2009

evensevenone posted:

Would this make you feel better? The last thing is evaluated always returned. Statements are separated by semicolons. if you put a semicolon, and there is nothing after it, what is returned is the evaluation of nothing, which is nil.

This discussion has passed and I don't have the rust compiler on this computer but is block-keyword { ; stuff } legal?

Add to that the fact that a stray semicolon will literally cause a compilation error even if it's in a space where they almost always are legal and you have a problem IMO.

edit: and I'm not sure "pay more attention when you code" is applicable here; thinking extremely hard about the placement of a ";" is probably not the best usage of a developer's time. Especially when an extremely subtle one character difference (that looks legal) is a compilation error.

edit(again): removed retarded incorrect statement made due to lack of sleep (this is a running theme)

Look Around You fucked around with this message at 11:53 on Feb 3, 2012

Adbot
ADBOT LOVES YOU

Zombywuf
Mar 29, 2008

evensevenone posted:

Would this make you feel better? The last thing is evaluated always returned. Statements are separated by semicolons. if you put a semicolon, and there is nothing after it, what is returned is the evaluation of nothing, which is nil.

No. It's still a major semantic change for what could be a spec of dust on your screen. I don't want to use a language where a bottle of screen cleaner is a debugging tool.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply