Author Topic: A few changes..  (Read 24846 times)

0 Members and 3 Guests are viewing this topic.

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
A few changes..
« on: August 21, 2011, 01:55:06 am »
Hello!

If you follow me on twitter, you certainly know that I was at a Ruby conference these past few days. As yesterday was Whyday, I decided to remove the ant build script and replace it with rake. This means two things:
  • Install JRuby, or you can't build JavaOp anymore.
  • Builds are a lot more awesome.

The ant script ran clean,build,jar on my MacBook Pro in about 8 seconds. Rake runs clean,build,jar in just under 13. You're probably thinking, "whytf did you do that, then?". Most of the startup time for rake with JRuby is loading a JVM (and using standard rake isn't an option for building Java projects). There's a neat project called Nailgun that keeps a server JVM running in the background. By typing 'jruby --ng-server &', you'll start up a Nailgun server, and then run 'jruby --ng -S rake clean build jar'. This still takes 13 seconds. However, JVM has been optimizing the compiler. Running it again only takes 7 seconds, so the ant script is outperformed after only two runs. The next takes 5 seconds. Do you see a trend? It's unlikely that I'll sit down, fix a bug, test, commit and push in one build cycle, and if I do, it only cost me an extra 5 seconds in build time.

Equally important, and much more important to users, is that rake is awesome for testing. I was using JUnit before, mostly to fix some CheckRevision bugs I made by testing local hashing directly against BNLS. JUnit is a real pain. I need to download the JAR, put it in the correct place, figure out dependencies and classpaths, etc etc, and maybe it'll run. Check this out:

Code: [Select]
[00:52:48] [william@enterprise ~/Documents/Git/GitHub/javaop2]$ jruby --ng -S rake test
Loaded suite /Users/william/bin/jruby-1.6.3/bin/rake
Started
Testing D2DV..  local: 573e1c0c, remote: 573e1c0c
Testing D2XP..  local: 7264e3da, remote: 7264e3da
Testing STAR..  local: -5bab8e79, remote: -5bab8e79
Testing W2BN..  local: -3122f25d, remote: -3122f25d
Testing WAR3..  local: 32a227d6, remote: 32a227d6
Testing W3XP..  local: 32a227d6, remote: 32a227d6
.....
Finished in 1.061 seconds.

5 tests, 15 assertions, 0 failures, 0 errors

This is really neat because now every time I run rake tests, it makes sure I didn't break CheckRevision. Unit testing is a Ruby philosophy, and being adopted in a bunch of other communities. Now, if I break CheckRevision (through any means leading up to the absolute result that gets sent to BNET), I'll be immediately notified. I'm sure this makes rabbit very, very happy.

Happy JavaOping.
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: A few changes..
« Reply #1 on: August 21, 2011, 01:54:02 pm »
Unit testing is a lot older than ruby...

Rake is fun and all, but I'd much rather have ant. Especially after having ivy. Maybe rake plays well with ivy, but i kinda doubt it's as seamless as it is with ant.

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: A few changes..
« Reply #2 on: August 21, 2011, 02:15:38 pm »
Unit testing is a lot older than ruby...

Yeah, but Rubyists and Railers do it at least 100x as much as anyone else.
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: A few changes..
« Reply #3 on: August 21, 2011, 03:09:36 pm »
Unit testing is a lot older than ruby...

Yeah, but Rubyists and Railers do it at least 100x as much as anyone else.

This is patently false in general, but maybe true in open source. "Unit testing is a Ruby philosophy" makes it sound like ruby folks are the originators of unit testing, which is clearly false.

I like ruby as much as the next guy, but it really sucks for a lot of things.

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: A few changes..
« Reply #4 on: August 21, 2011, 04:20:23 pm »
Unit testing is a lot older than ruby...

Yeah, but Rubyists and Railers do it at least 100x as much as anyone else.

This is patently false in general, but maybe true in open source. "Unit testing is a Ruby philosophy" makes it sound like ruby folks are the originators of unit testing, which is clearly false.

I like ruby as much as the next guy, but it really sucks for a lot of things.

I should say "most Rubyists and Railers unit test absolutely everything whereas others don't", and "unit testing is an agile programing philosophy, which is used heavily in Ruby". Of course, agile was only adopted by Ruby after the Rails-era began and was itself originated elsewhere, but the point is that I was introduced to agile and unit testing by rubyists and that's where I see it's primary use today.

I'm curious what things Ruby sucks for. I agree that it's terribly outperformed by {insert any other language here} when run on MRI, but with JRuby, or especially JRuby + Nailgun, it's deadly fast.
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: A few changes..
« Reply #5 on: August 22, 2011, 03:44:40 am »
Unit testing is a lot older than ruby...

Yeah, but Rubyists and Railers do it at least 100x as much as anyone else.

This is patently false in general, but maybe true in open source. "Unit testing is a Ruby philosophy" makes it sound like ruby folks are the originators of unit testing, which is clearly false.

I like ruby as much as the next guy, but it really sucks for a lot of things.

I should say "most Rubyists and Railers unit test absolutely everything whereas others don't", and "unit testing is an agile programing philosophy, which is used heavily in Ruby". Of course, agile was only adopted by Ruby after the Rails-era began and was itself originated elsewhere, but the point is that I was introduced to agile and unit testing by rubyists and that's where I see it's primary use today.

I'm curious what things Ruby sucks for. I agree that it's terribly outperformed by {insert any other language here} when run on MRI, but with JRuby, or especially JRuby + Nailgun, it's deadly fast.

Unit testing is incredibly common in a majority of software companies. The startup I just finished interning with had just as much test coverage for Java projects as it did for its Rails projects.

Weakly typed languages cause all sorts of trouble in bigger software projects.  If I'm doing something in cascading/mapreduce, I'd never wish the ability to do it in ruby. Fuck that.

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: A few changes..
« Reply #6 on: September 05, 2011, 04:27:42 am »
I just rewrote CheckRevision in Ruby, and man oh man did I wish I had int64's instead of just BigNum / FixNum. Having to do:

Code: [Select]
a = a & 0xffffffffffffffff
b = b & 0xffffffffffffffff
c = c & 0xffffffffffffffff

...after every iteration of the loop, yikes.

I need to commit that code at some point. I like the way I did it. I used blocks, kind of how MyndFyre dynamically emitted his version, but except not. I defied a block for each action ("A=A+S", etc) and fire each of the blocks on each iteration. I need to do an actual speed test to see if it's faster than the old structure.

For those curious, it does a StarCraft CheckRevision in ~3.6 seconds on MRI, or ~1.8 on JRuby on Nailgun (5th run).

EDIT -
And for those also curious, it's not replacing CheckRevision in JavaOp. I'm thinking about rewriting JBLS (RBLS?) to work better in low-memory situations. It may just be much better to keep a CheckRevision worker running in Java and cache results in ActiveRecord, though.
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline MyndFyre

  • Boticulator Extraordinaire
  • x86
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: A few changes..
« Reply #7 on: September 05, 2011, 12:40:05 pm »
Can't Ruby consume C libraries?  It seems like it might be faster to do something like that...

man oh man did I wish I had int64's instead of just BigNum / FixNum.
Yeah, I don't like this trend in scripting languages to limit the kinds of numbers that you can have.  JavaScript is terrible about that... there's no good currency-based math.  Best thing you can do is multiply everything by 100, finish your math, and divide by 100 when you're done. 

Unit testing is a lot older than ruby...

Yeah, but Rubyists and Railers do it at least 100x as much as anyone else.
I've heard you say a lot of retarded things, Joe, but this is easily the most retarded of the last year or so.
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: A few changes..
« Reply #8 on: September 05, 2011, 02:01:35 pm »
Unit testing is a lot older than ruby...

Yeah, but Rubyists and Railers do it at least 100x as much as anyone else.
I've heard you say a lot of retarded things, Joe, but this is easily the most retarded of the last year or so.

How so? Perhaps I should have said "People in the Ruby/Rails culture", or "open source developers in the Ruby/Rails culture". Nobody from a different programming background would ever write a sonnet about testing and present it at a conference, or would you?
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: A few changes..
« Reply #9 on: September 05, 2011, 02:17:35 pm »
Unit testing is a lot older than ruby...

Yeah, but Rubyists and Railers do it at least 100x as much as anyone else.
I've heard you say a lot of retarded things, Joe, but this is easily the most retarded of the last year or so.

How so? Perhaps I should have said "People in the Ruby/Rails culture", or "open source developers in the Ruby/Rails culture". Nobody from a different programming background would ever write a sonnet about testing and present it at a conference, or would you?

The problem is it's just wrong. Companies have been hiring software testers for decades. In case that's not clear, that means there are people who have full time jobs writing tests.

Offline Newby

  • x86
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: A few changes..
« Reply #10 on: September 05, 2011, 07:16:25 pm »
Unit testing is a lot older than ruby...

Yeah, but Rubyists and Railers do it at least 100x as much as anyone else.
I've heard you say a lot of retarded things, Joe, but this is easily the most retarded of the last year or so.

How so? Perhaps I should have said "People in the Ruby/Rails culture", or "open source developers in the Ruby/Rails culture". Nobody from a different programming background would ever write a sonnet about testing and present it at a conference, or would you?

The problem is it's just wrong. Companies have been hiring software testers for decades. In case that's not clear, that means there are people who have full time jobs writing tests.

So Ruby developers are the first developers to test their programs? lol. lol x like 10.
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Offline deadly7

  • 42
  • x86
  • Hero Member
  • *****
  • Posts: 6496
    • View Profile
Re: A few changes..
« Reply #11 on: September 05, 2011, 07:20:01 pm »
The problem is it's just wrong. Companies have been hiring software testers for decades. In case that's not clear, that means there are people who have full time jobs writing tests.
That sounds like the worst computer-related job I could ever think of.
[17:42:21.609] <Ergot> Kutsuju you're girlfrieds pussy must be a 403 error for you
 [17:42:25.585] <Ergot> FORBIDDEN

on IRC playing T&T++
<iago> He is unarmed
<Hitmen> he has no arms?!

on AIM with a drunk mythix:
(00:50:05) Mythix: Deadly
(00:50:11) Mythix: I'm going to fuck that red dot out of your head.
(00:50:15) Mythix: with my nine

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: A few changes..
« Reply #12 on: September 05, 2011, 07:22:36 pm »
The problem is it's just wrong. Companies have been hiring software testers for decades. In case that's not clear, that means there are people who have full time jobs writing tests.
That sounds like the worst computer-related job I could ever think of.

Maybe for you... some people like it.

Offline MyndFyre

  • Boticulator Extraordinaire
  • x86
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: A few changes..
« Reply #13 on: September 07, 2011, 02:41:19 am »
How so? Perhaps I should have said "People in the Ruby/Rails culture", or "open source developers in the Ruby/Rails culture". Nobody from a different programming background would ever write a sonnet about testing and present it at a conference, or would you?
I've seen a lot of people do a lot of weird things at a conference.  But another way to consider the example of someone writing a sonnet about testing in Ruby is that the Ruby tester didn't have enough other, productive things to do with his time.

More to the point, while he was writing sonnets about testing, I was writing a C# unit test that unit-tested the JavaScript for the updates GoDaddy is rolling out on my product around the end of the month.  38 tests for something like 120 lines of code.  And it turned out - lo and behold - that the unit tests found two bugs in my JavaScript.  People realized the value of unit testing well before Ruby was the little thought-sperm in Yukihiro Matsumoto's brain.

The problem is it's just wrong. Companies have been hiring software testers for decades. In case that's not clear, that means there are people who have full time jobs writing tests.
That sounds like the worst computer-related job I could ever think of.
I thought it was odd too, but we have a dedicated QA department at GoDaddy and most of them are not programmer-level technical people in the least.  http://www.joelonsoftware.com/items/2010/01/26.html
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: A few changes..
« Reply #14 on: September 07, 2011, 04:21:26 am »
People like breaking stuff. They're the kids that liked kicking sandcastles.