havenwood has quit [Remote host closed the connection]
tsion has joined #ruby-lang
tsion has quit [Changing host]
tsion has joined #ruby-lang
nathanstitt has quit [Quit: I growing sleepy]
chimkan has joined #ruby-lang
cofin has joined #ruby-lang
lguardiola has quit [Ping timeout: 264 seconds]
seoaqua has joined #ruby-lang
r0bby_ has quit [Excess Flood]
r0bby_ has joined #ruby-lang
priodev has quit [Ping timeout: 245 seconds]
guns has quit [Ping timeout: 252 seconds]
<rickhull>
hitting something unexpected playing with minitest must_output
Nisstyre-laptop has quit [Ping timeout: 256 seconds]
<rickhull>
i tried passing a regex, and i'm not getting any particular complaints about that
<rickhull>
but i am getting failures: Expected /debug (0)/ Actual: ""
<rickhull>
this seems misleading to me, because i'm pretty darn sure i am actually outputting something matching /debug (0)/
cofin has quit [Quit: cofin]
<rickhull>
so it looks like regex is not supported, that's fine. but Actual: "" is misleading
priodev has joined #ruby-lang
crankharder has quit [Read error: Connection reset by peer]
malign is now known as dd
dd is now known as malign
asunderland has joined #ruby-lang
asunderl1nd has quit [Ping timeout: 248 seconds]
chimkan has left #ruby-lang [#ruby-lang]
seoaqua has quit [Ping timeout: 252 seconds]
sush24 has joined #ruby-lang
Swimming_Bird has quit [Ping timeout: 256 seconds]
<rickhull>
am I right about the lack of regex support? if so, seems like a useful feature, no?
tomzx_mac has quit [Ping timeout: 256 seconds]
Swimming_Bird has joined #ruby-lang
r0bby_ has quit [Remote host closed the connection]
xxaM has joined #ruby-lang
krombr has joined #ruby-lang
Wardrop has joined #ruby-lang
lele` has quit [Read error: Operation timed out]
<rickhull>
assert_output calls capture_io and then assert_equal. so pretty straightforward, and regex won't work
vlad_starkov has joined #ruby-lang
lele has joined #ruby-lang
<rickhull>
i'm wondering if capture_io is not working correctly. i am seeing the output i expect (in the middle of the test run) and then minitest says the actual output was empty
<rickhull>
v0v
vlad_starkov has quit [Ping timeout: 248 seconds]
guns has joined #ruby-lang
<rickhull>
hmm, looks like PEBKAC error. restructured and it works as expected
<rickhull>
er, nope. it "works" if I pass nil instead of a regex
vlad_starkov has joined #ruby-lang
<rickhull>
which seems odd. nil indicates ~any output~ while "" indicates silent output
hahuang65 has joined #ruby-lang
<rickhull>
specifically rdoc says: Pass in nil if you don’t care about that streams output. Pass in “” if you require it to be silent.
<rickhull>
given that this is assert_output, i assume nil means not just "I don't care" where empty would be acceptable, but that ~some output~ is required
<drbrain>
richo: why do you need to send the type?
<judofyr>
richo: who cares about 1.8? :)
<ironcamel>
when you tie a hash to a db, the hash becomes an interface to the db. if that's not what you want, then tie'ing is not the approach you want.
mootpointer has quit [Quit: Computer has gone to sleep.]
<richo>
judofyr: I do
<richo>
until OSX stops shipping it
<erikh>
ironcamel: better put than me, thanks.
<drbrain>
richo: that's likely to be "never"
<richo>
drbrain: because cmp("object", String) reads way more sanely than cmp("object", "stringforsomereason")
<erikh>
people always cringe a little at tie, until they use it
<whitequark>
erikh: ironcamel: my point is that hashes have a defined interface. that interface (even if you take concurrency into account) does not imply that arbitrary code may be executed, and so on.
<drbrain>
richo: when I see 'cmp("object", String)' I think "compare a string with a class"
<whitequark>
erikh: please read my message first
<drbrain>
but your method does not do that
<erikh>
whitequark: yes, you're describing this problem
<richo>
drbrain: cmp returns a Comparator
<erikh>
this is just a classic data race
<richo>
drbrain: it's a translation layer from a ruby DSL to posix shell (or vimscript.. or whatever else someone writes a backend for)
<erikh>
there's nothing inherently surprising about the data disappearing by external side effect
<drbrain>
richo: in that case, use an if instead of a case statement
<richo>
so the compiler needs typehints about what the first arg will be at runtime, it'll nearly always be a ruby string even if it's bound to some arbitrary type
<erikh>
your problem is that you're mutating a singleton in multiple processes (or threads, as the case is above)
<whitequark>
erikh: "take concurrency into account" was meant as "ignore concurrency problems". that is... for example, hash lookup should be O(1).
<whitequark>
this is a part of hash interface.
<erikh>
no
<erikh>
actually, hash lookup is best-case O(1)
<drbrain>
richo: I have a feeling your interface is much too large
<richo>
drbrain: that's what I'll have to do. Thanks.
rsync has quit [Ping timeout: 256 seconds]
<richo>
drbrain: can you explain what you mean?
<erikh>
and we're not talking about hashing algorithms
<erikh>
we're talking about dictionaries.
<erikh>
(they're just always called hashes in perl)
woollyams has quit [Quit: Computer has gone to sleep.]
<erikh>
naive hashing (which ruby used *forever*) has a pretty painful worst-case IIRC
<richo>
backends implement cmp() to do something reasonable for their platform (ie, on posix everything is a string but you need to do different things to compare string with ints in them numerically)
<erikh>
the modulo->ll pattern
<drbrain>
richo: maybe I used the wrong words
<whitequark>
erikh: elaborate?
<drbrain>
but you pass in two things, but allow one to be nil, but always prefer the latter
<erikh>
fixed buckets, hash is calcuated from <magic sum> % buckets, used to find a linked list which is then search/cmp'd until key/value is found
<whitequark>
ah, right, this affects lookup too
<drbrain>
richo: you seem to be trying to flatten out OO-thoughts into imperative thoughts
<richo>
ugh, I always forget I can't def cmp/type :/
<whitequark>
erikh: you're right about best-case O(1), indeed.
<erikh>
it's also a DDoS
<richo>
drbrain: it's a compiler. It's not particularly OO :)
<whitequark>
yeah (and in perl too)
<erikh>
er, just a DoS
marr has joined #ruby-lang
<erikh>
they fixed it in 5.6
<erikh>
about.. a decade ago
<drbrain>
richo: yeah
<whitequark>
it was :)
<whitequark>
fixed in ruby too
<erikh>
yep
<erikh>
anywho, point is, if we're going to talk about hash maps/tables as the algorithms are concerned, no, tie does not address that.
<whitequark>
ok. so. what this boils down to is that perl doesn't have hash tables, it just has dictionaries, and interface guarantees for these objects are way weaker than, for example, for Ruby's Hashes
<erikh>
no
<erikh>
perl has very fast hash tables
mixandgo has joined #ruby-lang
<whitequark>
it doesn't matter from the language point of view
<erikh>
tie just backs the i/o with something else
<erikh>
you could implement proper perfect hashes with tie
<erikh>
and they might be faster than perl's native hashes for some data sets.
lupine has joined #ruby-lang
<drbrain>
bed time
<whitequark>
>could. it is not a *guarantee*. a dictionary may or may not adhere to requirements for hash tables.
noop_ has quit [Ping timeout: 264 seconds]
<erikh>
drbrain: night. thanks again for tweeting!
<erikh>
whitequark: I think you're missing the point here
<erikh>
it's a MitM for an interface that keeps key/value storage, more or less, presented as a native data structure
<whitequark>
erikh: I understand very well what it is
<erikh>
you still *know* it's different
<erikh>
well, whoever created it does at least.
<whitequark>
^ exactly!
<erikh>
I'm not sure I'm getting the point of this
<erikh>
bad code is bad code.
<richo>
drbrain: https://gist.github.com/richo/5582441 , but now explodes for subclasses of any of those primitives. Is there some reasonable way to do this that I'm not seeing?
<ironcamel>
whitequark: fwiw, you can determine if a hash is tied via the tied() function
<whitequark>
ironcamel: I know
<ironcamel>
whitequark: how do you know that?
<whitequark>
ironcamel: ... I read the docs?
<whitequark>
I'm not in the mood today to argue without even learning anything about the topic
mixandgo has left #ruby-lang [#ruby-lang]
<ironcamel>
whitequark: you are a better man than me :)
<ironcamel>
*or woman
<erikh>
whitequark: relax dude, I'm not attacking you and I don't think anyone else is either.
solars has quit [Read error: Operation timed out]
<erikh>
just a little surprised you picked up so much in 20 minutes :)
<whitequark>
erikh: I don't think you do :)
stamina has joined #ruby-lang
<erikh>
cool, man
<whitequark>
erikh: ironcamel: lemme explain this another way. Features such as tie() (and, yes, concurrency with shared memory, indeed) make it much harder to reason about code fragments in isolation. so, for example, given hash[:a], hash[:b] = hash[:b], hash[:a]
<erikh>
oh, I'm disagreeing with that
<whitequark>
you don't exactly have a way to say what will happen even if you know that hash is a Hash.
<erikh>
what I am saying is that harder doesn't necessitate the non-existence of a feature is all
<erikh>
go handles this really elegantly
<whitequark>
however, you could argue that in Ruby, there is same problem present: anyone could override anything on Hash, and that would be right
<erikh>
surprisingly so
<ironcamel>
whitequark: fwiw, i personally wouldn't tie a hash to a db. tie'ing an array to a file is common and kind of cool. each line of the file corresponds to an item in the array.
<erikh>
sorry, to be clear -- go gets a lot of mileage out of a very small feature set.
<erikh>
also I just learned it so it's the best thing ever for a few weeks at least. deal with it. :P
<whitequark>
and this is why I said this is "bad design"... while in Ruby you can avoid monkeypatching Hash (there are other ways), in perl this is encouraged
<whitequark>
and the last part
<erikh>
it's not a monkeypatch, though.
<erikh>
tie only works on a single object.
<ironcamel>
yeah, its not global
<erikh>
it associates it with a class that implements the functionality.
<whitequark>
sure. I don't think you can provide this functionality in perl in any other way so that it will be convenient enough to use.
<ironcamel>
really?
<erikh>
err, a package.
<whitequark>
ironcamel: well, if you insist on having a compatible interface, it seems that you can't, to me
<erikh>
I don't think monkeypatching is really a solution here
<ironcamel>
you don't think perl has a way to provide an interface to a db?
<erikh>
ironcamel: I think there are some crossed wires here
<ironcamel>
probably
<erikh>
that's not what I heard, at least.
* whitequark
sighs
<erikh>
whitequark: so, a fundamental thing here is that hashes are not objects in perl in the traditional sense
<whitequark>
erikh: exactly
<erikh>
right. so they can actually be a hash and another "thing" at the same time.
richo has quit [Ping timeout: 256 seconds]
<erikh>
same with strings and arrays, etc.
<whitequark>
if you want something that quacks like a hash in perl, you have to use a hash, or it seems so, to me
<erikh>
right, but in ruby this could be done with singleton classes.
<erikh>
make the hash, class << hash, etc etc.
<whitequark>
my point would be that in ruby, this could be done *without* singleton classes :)
<erikh>
with direct monkeypatching, sure
<whitequark>
with just a different class.
<erikh>
but then you'd get nothing but those kinds of hashes.
<whitequark>
BackedDictionary.
<erikh>
oh, yes. that's what I do with Palsy.
<erikh>
the problem is, having that gated interface
<erikh>
delete_at vs delete, etc.
<whitequark>
yea. I think that Palsy, wrt/ design, is better than tie().
<erikh>
I'm not so sure about that.
<erikh>
but we can agree to disagree on such subjects. :)
faces has joined #ruby-lang
<erikh>
fwiw, if you want a really killer implementation, Moneta is much better and a lot more flexible.
<erikh>
Palsy quite literally does exactly what I f'n want. :P
gnufied has quit [Quit: Leaving.]
bzalasky has quit [Remote host closed the connection]
face has quit [Ping timeout: 252 seconds]
<whitequark>
erikh: yeah. and from what it seems to me, Moneta does not emulate a Hash
<erikh>
Moneta's a carlhuda project too IIRC, so it gets a lot more eyeballs
Wardrop has joined #ruby-lang
<erikh>
Moneta emulates several data structures
solars has joined #ruby-lang
<whitequark>
(as in, it has several Hash-compatible methods, but it does not try to look *exactly* like a hash. And that is good)
<erikh>
Oh, I use the word emulate differently
<erikh>
fair play.
<whitequark>
when I talked about having a mixin which you can use to emulate a Hash, I did not have your, or moneta's use case in mind
<erikh>
ah ok
<whitequark>
it would be suitable for mocking, for example... this kind of stuff
<erikh>
I guess that's where we got confused.
<whitequark>
when it's still a Hash, but you need some instrumentation in it.
<whitequark>
or maybe you want to experiment with different algorithms.
<erikh>
yeah, Moneta probably could make for an interesting way to do hash transaction logs
<erikh>
that might be fun.
<whitequark>
*not* networked io or whatever
face has joined #ruby-lang
<erikh>
well integration testing these kinds of things will always be hard
<erikh>
and I really hate mocks
<erikh>
really, really hate mocks
<erikh>
but that's a different subject
<whitequark>
mocks are often abused.
<whitequark>
beyond all reason
faces has quit [Ping timeout: 276 seconds]
<whitequark>
perl's threads are... weird
<erikh>
perl's threads suck
<erikh>
there's nothing else to say.
<whitequark>
the threads::shared avoids aliasing as much as it's possible
<whitequark>
or so it seems
gnufied has joined #ruby-lang
<whitequark>
but it's basically multivm, not a threaded vm
<ironcamel>
perl threads emulate fork
<erikh>
nobody uses them, and things like Coro come with so many "don't do that" rules that I'm amazed anyone puts up with it
<ironcamel>
so not memory sharing by default
<whitequark>
yeah
<ironcamel>
yeah, they are discouraged
<ironcamel>
they were originally for emulating fork() on windows machines
<ironcamel>
so code you wrote that called fork() would work on platforms that did not support it, like windows
<ironcamel>
then someone exposed this internal implementation and called them threads
<erikh>
oh, I didn't realize they were borne from that
<erikh>
so that's probably activestate wasn't it?
<ironcamel>
no idea
<erikh>
they did one of the first ports to windows
<whitequark>
ugh, windows
<ironcamel>
so are ruby fibers pretty awesome?
noop has joined #ruby-lang
<ironcamel>
i always wanted to play with them
<whitequark>
ironcamel: ruby threads and fibers, well, work.
<whitequark>
properly.
<whitequark>
threads still have the global VM lock, and thread/fiber-local variables are awkward.
<whitequark>
that's about it
<erikh>
I like threads in ruby
<erikh>
the GIL lets you cheat on a few synchronization problems.
<judofyr>
waaaaay better than "threads" in Perl
<whitequark>
shared mutable state is meh everywhere
<kke>
i have this soap api thing that for example returns errors in the struct defined by wsdl, so in login i need to return like UserParamsOut(:status => "ERROR: Blahblah") and CompanyParamsOut(:status => "ERROR: Blahblah") etc, so i figured i just pass the class name in the login method so it returns a proper object by doing out_class.new(...)
<kke>
yorickpeterse: yes, that i knew, but i'd like it to work with an actual class
<kke>
not instances
<kke>
out_class.class is always Class
<kke>
out_class == OutClass is true but case uses === i thinks
<kke>
maybe i'll just have to create the instance beforehand then
apeiros has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
gix has quit [Ping timeout: 276 seconds]
noop has joined #ruby-lang
Phoop has joined #ruby-lang
gix has joined #ruby-lang
apeiros has joined #ruby-lang
alessio_rocco has quit [Ping timeout: 256 seconds]
alessio_rocco has joined #ruby-lang
<yorickpeterse>
whitequark: is it possible to get rid of that coveralls bot in parser? It's super annoying when it keeps telling the code coverage decreased by 0%
<yorickpeterse>
what the hell, there's a `require "English"`?
<wnd>
gazillion tests that expect real, live postgres through sequel
<eam>
I had one that took half a week - it was a packaging system
<ericwood>
sheeiiiiit
<eam>
lots of fetching, extracting, and iterating over huge trees of files
<wnd>
luckily it's fine with empty db on localhost, but unfortunately it doesn't clean up its trash and consequently may fail because of the garbage that was left behind
jsullivandigs has joined #ruby-lang
<yorickpeterse>
wnd: we use DatabaseCleaner for that
<yorickpeterse>
which is slow as balls though, so we only use it during boot
<wnd>
I think we used that at some point, but ditched it as it didn't clean up everything. I don't know the details, that was before I started here.
Swimming_Bird has quit [Quit: Computer has gone to sleep.]
<wnd>
still have bits and pieces in helper files, DatabaseCleaner.logger = Logger.new("DatabaseCleaner.log")
alessio_rocco has quit [Ping timeout: 248 seconds]
<wnd>
umm, actually, it's still there, but only used for mongo
justinmburrous has quit [Remote host closed the connection]
<yorickpeterse>
heh
<wnd>
and a commetn says "db cleaner won't work with sequel, but s transaction rolled backaround each example"
<yorickpeterse>
in our two main apps we used it for every. fucking. expectation
<yorickpeterse>
I managed to get rid of it in about 80% of the cases
alessio_rocco has joined #ruby-lang
<whitequark>
>mongo
<whitequark>
you can end here
<yorickpeterse>
and in this new project I just use the models that are actually used (Foo.destroy_all, etc), unless there's actually a lot of different tables being used
<yorickpeterse>
whitequark: it serves a purpose, get over it
benlovell has quit [Ping timeout: 248 seconds]
<whitequark>
yorickpeterse: doesn't
<wnd>
mongo seems to work reasonably well as data storage for metrics
ykk` has quit [Quit: ykk`]
<yorickpeterse>
whitequark: seems to work pretty well for our 120GB of data
<yorickpeterse>
if it's not more by now
<whitequark>
pull the plug out of your server, watch
benlovell has joined #ruby-lang
panpainter has joined #ruby-lang
<yorickpeterse>
whitequark: actually that won't do a thing
<wnd>
I don't pretend that I like mongo but it's not like I have a choice
<yorickpeterse>
we don't use sharding so about 80% of all the bullshit doesn't really affect us
<yorickpeterse>
That's not to say it wasn't trouble getting here from what I've heard
schaerli has quit [Remote host closed the connection]
jvrmaia has quit [Remote host closed the connection]
solars has quit [Ping timeout: 276 seconds]
<yorickpeterse>
whitequark: and no offense but have you actually used Mongo? I'm seeing way too many people hate on it while never having used it for more than their DIY blag
jvrmaia has joined #ruby-lang
<yorickpeterse>
which is a stupid use case for mongo
asunderl1nd has joined #ruby-lang
asunderland has quit [Ping timeout: 248 seconds]
<judofyr>
btw, anyone knows how Facebook scales their MySQL? I've heard a lot about Memcached at Facebook, but not MySQL…
<apeiros>
I thought facebook used cassandra?
<judofyr>
they used cassandra for the messaging system
<whitequark>
yorickpeterse: I'm not anti-nosql. nosql has its use cases... has them for last forty years or maybe more
<whitequark>
I don't like one fucking dumb database
<judofyr>
whitequark: "Facebook used Cassandra to power Inbox Search, with over 200 nodes deployed.[2] This was abandoned in late 2010 when they built Facebook Messaging platform on HBase.[3]"
<whitequark>
judofyr: ok
<judofyr>
oops
<judofyr>
apeiros: "Facebook used Cassandra to power Inbox Search, with over 200 nodes deployed.[2] This was abandoned in late 2010 when they built Facebook Messaging platform on HBase.[3]"
Criztian has joined #ruby-lang
krohrbaugh has joined #ruby-lang
jvrmaia has quit [Ping timeout: 245 seconds]
<apeiros>
aha
asunderland has joined #ruby-lang
krohrbaugh has quit [Ping timeout: 252 seconds]
hramrach_ has joined #ruby-lang
Swimming_Bird has joined #ruby-lang
asunderl1nd has quit [Ping timeout: 252 seconds]
justinmburrous has joined #ruby-lang
<yorickpeterse>
whitequark: personal opinions and what not are fine, I however don't like it when people start bitching about something they may haven't even used yet
<yorickpeterse>
From a technical point there's a lot of stupid shit in Mongo (e.g. the safe writing bullshit, locks everywhere, etc) but so far here it hasn't really looked like the pile of shit people make of it
<yorickpeterse>
having said that, when you start using Mongoid to fake joins and what not it does become weird to say the least
benlovell has quit [Ping timeout: 260 seconds]
Squarepy has quit [Quit: Leaving]
JpC0utur3 has quit [Ping timeout: 252 seconds]
<yorickpeterse>
but I suppose I should stop reading HN. The moment you mention Mongo it turns into one massive circlejerk about how bad mongo is compared to <insert database not a single nerd uses>
<yorickpeterse>
"WELL I THINK YOU SHOULD USE DERPINADB BECAUSE WE USE IT FOR OUR BIG DATA HADOOP STORAGE CLUSTER MEMCACHED BASECAMP"
<yorickpeterse>
Ok I'm done
<judofyr>
DerpinaDB is pretty nice though
<andrewvos>
Seems silly to use cassandra in ruby because the gems for it aren't very mature.
<andrewvos>
The only option really is Mongo, because of its widespread use
djwonk has joined #ruby-lang
<zzak>
key to happiness: dont read hn, or youtube comments
* andrewvos
has left the conversation...
vlad_starkov has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
tbuehlmann has joined #ruby-lang
dankest has quit [Quit: Leaving...]
vlad_starkov has joined #ruby-lang
vlad_sta_ has joined #ruby-lang
<yorickpeterse>
in unrelated news, Rails engifying stuff is a fucking pain in the royal ass
<yorickpeterse>
retarded dependencies everywhere
<yorickpeterse>
And this app has a dir called "app/enums" with a bunch of classes in them. Not a single class has any methods or whatsoever
andre____ has joined #ruby-lang
andre____ has quit [Remote host closed the connection]
<yorickpeterse>
srsly
<andrewvos>
orly?
andre____ has joined #ruby-lang
justinmburrous has quit [Remote host closed the connection]
<yorickpeterse>
yarly
<yorickpeterse>
Today is "Yorick rages on code day", in other words it's a normal day
<andrewvos>
orly?
bothra has quit [Ping timeout: 264 seconds]
<yorickpeterse>
get out hammilton
vlad_starkov has quit [Ping timeout: 252 seconds]
havenwood has joined #ruby-lang
andre____ is now known as andrewhl
bothra has joined #ruby-lang
asunderl1nd has joined #ruby-lang
andrewhl has quit [Remote host closed the connection]
<andrewvos>
orly?
<eam>
no one wants to hear that mysql is generally the best choice
asunderland has quit [Ping timeout: 241 seconds]
<andrewvos>
Umm, it isn't?
<eam>
see?
<andrewvos>
Wait no you won't getme!
<yorickpeterse>
ugh, you mean that database with a proper type validation system?
<eam>
andrewvos: :) yorickpeterse: right, it's real gross and has warts -- totally valid for everyone to hate it
<yorickpeterse>
or the one with an equally broken set of different table storage mechanisms, including BLACKHOLE (who the hell would use that anyway)?
<eam>
but it has absolutely the best HA and replication story
<eam>
and at scale that's what matters most
<yorickpeterse>
I'd rather have a somewhat saner database
<yorickpeterse>
one that can scale equally well
<eam>
yorickpeterse: me too
<yorickpeterse>
e.g. Postgres
<eam>
postgres doesn't
<yorickpeterse>
pretty sure a lot of people disagree with that
<eam>
it's missing key features (or has gotten them super recently) like chained replication. And when you look at the operations necessary to perform failover, generally they involve loss of redundancy
<eam>
yorickpeterse: postgres is my favorite for dev on my laptop
<eam>
but I'll port my stuff to an ugly database like mysql to get top quality replication and operability before I hit production
wallerdev has quit [Quit: wallerdev]
<yorickpeterse>
I have only limited experience with Pg replication so I can't comment too much on it
<eam>
yorickpeterse: from a developer standpoint, pg wins hands down by a mile
dhruvasagar has joined #ruby-lang
scottschecter has quit [Quit: WeeChat 0.4.0]
<eam>
but mysql scales
<yorickpeterse>
the fact that is has proper type validation itself is already a win
<yorickpeterse>
hm, I wonder if I can migrate our MongoDB (at least one collection) to Pg and see how it handles it
<eam>
imo a sharded sql is a more stable platform than most nosql up-and-comers
alessio_rocco has quit [Ping timeout: 256 seconds]
alessio_rocco has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 248 seconds]
<yorickpeterse>
home tiem, taters
swav has quit [Remote host closed the connection]
<whitequark>
"piece of rails"
rwilcox has quit [Quit: Computer has gone to sleep.]
swav has joined #ruby-lang
headius has quit [Ping timeout: 246 seconds]
<injekt>
shambles
sush24 has joined #ruby-lang
swav has quit [Remote host closed the connection]
<ericwood>
uh oh, are we going down the "rails is a ghetto" path again?
workmad3 has quit [Ping timeout: 264 seconds]
dankest has joined #ruby-lang
machuga is now known as machuga|away
<whitequark>
also linux is shit (actually it's either just bad SSD or me misconfiguring the kernel, but any amount of IO is totally killing the system)
<whitequark>
probably the latter.
<whitequark>
ericwood: no. I hate all web development without exception.
<ericwood>
heh
<ericwood>
I just hate computers in general
thebastl has joined #ruby-lang
* whitequark
shrugs
<whitequark>
it's about interfaces, those who design them and those who fix them
thebastl has quit [Remote host closed the connection]
<whitequark>
and those who use them.
glebm has quit [Quit: Computer has gone to sleep.]
elia has joined #ruby-lang
dhruvasagar has joined #ruby-lang
jvrmaia has joined #ruby-lang
<whitequark>
argh, they renamed `spring c` to `spring rails c`
<whitequark>
my fucking fingers
io_syl has joined #ruby-lang
pskosinski has quit [Remote host closed the connection]
<apeiros>
alias
<ericwood>
truth
* apeiros
doesn't even want to type `rails c`
<apeiros>
I just type rc
<ericwood>
so lazy
<whitequark>
wat the fuck, why did some random method suddenly return a random V8 class
pskosinski has joined #ruby-lang
<whitequark>
it's not even from a Cext
intellitech has quit [Ping timeout: 256 seconds]
headius has joined #ruby-lang
<whitequark>
is there a unix utility for checking your own sanity
<whitequark>
brck?
<whitequark>
oh, right, it's just a global monkeypatch, nevermind.
tenderlove has joined #ruby-lang
asunderl1nd has quit [Remote host closed the connection]
Nisstyre-laptop has joined #ruby-lang
headius has quit [Ping timeout: 256 seconds]
schaerli has joined #ruby-lang
scottschecter has joined #ruby-lang
<darix>
eam: even if rhel7 is shipping with 1.9.3 .... do you know how long rhel 5 and 6 will still be around after that. ;)
<darix>
if i recall correctly they just went to 10 or more years for the full time
dhruvasagar has quit [Ping timeout: 252 seconds]
malev has joined #ruby-lang
apeiros has quit [Remote host closed the connection]
<eam>
darix: yeah, they will be
judofyr has quit [Remote host closed the connection]
ryez has joined #ruby-lang
<eam>
long lifecycles make dynamic platforms like ruby quite frustrating :)
alessio_rocco has quit [Quit: Lost terminal]
justinmburrous has joined #ruby-lang
djwonk has quit [Quit: djwonk]
swav has joined #ruby-lang
vlad_sta_ has quit [Remote host closed the connection]
swav has quit [Remote host closed the connection]
<darix>
eam: well in the 7-10+years of an enterprise distro ...even slower platforms develop a lot
ryez has quit [Ping timeout: 256 seconds]
pskosinski has quit [Ping timeout: 256 seconds]
<eam>
darix: kinda. I supported a 15 year swath of perl platforms for a while -- near complete backwards compatibility
elia has quit [Ping timeout: 276 seconds]
<eam>
C - same story
<eam>
I'm not saying it's bad, it's just difficult
dbussink has quit [Ping timeout: 264 seconds]
<eam>
python also breaks things
<ericwood>
I break things
sindork has quit [Ping timeout: 252 seconds]
brixen has quit [Ping timeout: 264 seconds]
pskosinski has joined #ruby-lang
glebm has joined #ruby-lang
rippa has joined #ruby-lang
krohrbaugh has joined #ruby-lang
krohrbaugh has quit [Client Quit]
cofin has joined #ruby-lang
krohrbaugh has joined #ruby-lang
benlovell has joined #ruby-lang
Oloryn_lt2 has joined #ruby-lang
dhruvasagar has joined #ruby-lang
sindork has joined #ruby-lang
adambeynon has quit [Quit: Computer has gone to sleep.]
brixen has joined #ruby-lang
dpatel has joined #ruby-lang
headius has joined #ruby-lang
dbussink has joined #ruby-lang
jvrmaia has quit [Ping timeout: 245 seconds]
<yorickpeterse>
whitequark: fsck self
kstone has joined #ruby-lang
jvrmaia has joined #ruby-lang
hashkey has joined #ruby-lang
<yorickpeterse>
also I'm on a train
<yorickpeterse>
and the wifi is terrible
tylersmith has joined #ruby-lang
<yorickpeterse>
first world problems
<whitequark>
no wifi on trains here
<whitequark>
even when they claim that it is, the network is there but uplink is missing
<yorickpeterse>
mine is routed through germany it seems
<yorickpeterse>
NL -> bunch of local IPs that make no sense -> Germany -> the internet
<yorickpeterse>
aaand station is up, brb
schaerli has quit [Remote host closed the connection]
LinkedoT has joined #ruby-lang
robbyoconnor has joined #ruby-lang
dhruvasagar has quit [Read error: Operation timed out]
brianpWins has joined #ruby-lang
swav has joined #ruby-lang
swav has quit [Remote host closed the connection]
rwilcox has joined #ruby-lang
mytrile_ has joined #ruby-lang
kgrz has quit [Ping timeout: 252 seconds]
workmad3 has joined #ruby-lang
robbyoconnor has quit [Ping timeout: 245 seconds]
LinkedoT has quit [Quit: This computer has gone to sleep]
ebouchut has joined #ruby-lang
jxpx777 has joined #ruby-lang
Sarcophabus has joined #ruby-lang
<dbussink>
yorickpeterse: it's t-mobile, not too surprised it goes through germany at some point :)
ikrima has joined #ruby-lang
krombr has quit [Quit: krombr]
malev has quit [Remote host closed the connection]
<spike|spiegel>
that's better than going to japan and crossing pacific to reach US East
<eam>
gigs - should be megs. If I explicitly gc each loop it's ok
<eam>
it can't even complete when n > 100k
<apeiros>
and might want to add Array#concat to the bench (assuming you're looking for the fastest)
<whitequark>
andrewvos: yes
<eam>
apeiros: agree. I'm sidetracked now looking at why the gc is so bad in this case
<andrewvos>
whitequark: okay ):
<eam>
I know a += b will necessarily be less efficient, but I didn't expect it to (apparently) leak every object
<apeiros>
gc never was one of the strong sides of ruby. afaik it got better in 1.9, and in 2.0 again
<apeiros>
but I'd not bet on it being great
<apeiros>
jruby should fare much better in that regard
<eam>
yeah
<andrewvos>
Well you're creating a new variable every time aren't you?
<eam>
yes
melter__ has quit [Quit: Client exiting]
<apeiros>
s/variable/object/ ;-)
<apeiros>
</nitpick>
<eam>
I expect a += b to be slower -- but I didn't expect it to eat gigs of ram and fail entirely
athaeryn has quit [Read error: Connection reset by peer]
melter has joined #ruby-lang
<eam>
it will complete with an explicit gc call
<eam>
slower, of course
<eam>
n = 20k on my system will just barely be able to run with 2G ram
<eam>
100k dives into swap and has no hope
<whitequark>
eam: -Xmx1G
<yorickpeterse>
eam: the reason is easy to explain
<yorickpeterse>
you're explicitly creating a memory leak
<yorickpeterse>
20k times you create an ever growing array
<andrewvos>
I set my hand on fire why is it hurting now
<yorickpeterse>
but you create a new one every time instead of just pushing stuff to it
glebm has joined #ruby-lang
<yorickpeterse>
it's like saying "why does malloc(sizeof(Universe)) crash?"
<andrewvos>
To be fair that would have caught me out big time. Seems very strange.
<yorickpeterse>
hold on
S1kx has quit [Quit: Leaving]
* andrewvos
holds on
<yorickpeterse>
so for each version lets suffix the variable "a" with a number
<yorickpeterse>
a1 is [1,2,3,4,5,6,7]
<yorickpeterse>
you then create a1 by basically doing a1 + [8,9,10,11,12,13] which results in `a2 = [1,2,3,4,5,6,7,8,9,10,11,12,13]`
havenwood has quit [Remote host closed the connection]
krohrbaugh has quit [Ping timeout: 248 seconds]
<yorickpeterse>
then you do `a3 = [1,2,3,4,5,6,7,8,9,10,11,12,13] + [8,9,10,11,12,13]` and keep repeating that
<andrewvos>
So it is recursive?
<yorickpeterse>
You'll end up with an array with 120007 items, but said to get there you had to create 20k + 1 (the initial one)
<yorickpeterse>
`a += b` really translates to `a = a + b`
<yorickpeterse>
unless Array overrides it but I don' think that's the case
<yorickpeterse>
hm, you can't evne define that as a method
<yorickpeterse>
Do note that this is based on my knowledge, I may be completely wrong
<yorickpeterse>
tl;dr don't use += in a loop
<yorickpeterse>
at least not for complex data structures
<apeiros>
a += b # with a and b being Arrays creates a new array. `a` references a new object after +=. the old object is no longer referenced and hence free for collection.
<apeiros>
that's not a memory leak.
<apeiros>
if ruby leaks that memory, then it's a bug.
<erikh>
you need to hit a GC boundary more or less
<yorickpeterse>
you still create the objects for which you need to initially allocate memory
<yorickpeterse>
remember that `a` is constantly growing
<apeiros>
for which ruby allocates memory. and which memory ruby is supposed to free.
chrishunt has joined #ruby-lang
<yorickpeterse>
Ruby never gives memory back to the OS
<apeiros>
yes. but it is growing within bounds far below those gigabytes
<yorickpeterse>
oh I'm not sure about the actual size, I haven't ran it yet
<yorickpeterse>
hm, only seems to allocate around 20MB for me
<eam>
yorickpeterse: if I explicitly call gc, it runs ok (slow, as expected, but same general order of memory as the other methods)
<yorickpeterse>
what ruby version?
<eam>
1.8.7 (I know, I know)
<yorickpeterse>
well there's your problem
<yorickpeterse>
1.8 GC is shit
<eam>
evidently =/
<apeiros>
that has been established already :)
pr0ton has joined #ruby-lang
hahuang65 has joined #ruby-lang
<eam>
I am surprised at the size of the suckitude -- I didn't expect to grab gigs of small objects before it kicked in
mucker has joined #ruby-lang
<yxhuvud>
it would probably be better if you put the code in a method and called that many times instead
hidalgo has joined #ruby-lang
<eam>
yxhuvud: you mean better for the gc?
<yxhuvud>
yes
<eam>
interesting - why?
enebo has joined #ruby-lang
<rue>
injekt: I can’t remember exactly what the symptom was, but basically the way the code works (worked?) is that if you don’t pass in the URL, it’ll use the stream’s #path, which is a tempfile
<injekt>
rue: what does it use that for, though? can i reproduce this?
barttenbrinke has quit [Remote host closed the connection]
ebouchut has quit [Quit: This computer has gone to sleep]
<yxhuvud>
dunno.
<yorickpeterse>
eam: introduces a change of scope, which triggers the gc
<eam>
yeah, it's good advice - it runs perfectly with: { a = 1,2,3,4,5,6,7; n.times do; foo(a, b); end } and def foo(a, b); a += b; return a; end
<eam>
a mere 2x as slow
<eam>
same O()
<yxhuvud>
that .. doesn't modify a though.
<eam>
... oh right
<eam>
whoop, still real slow
<eam>
RSZ = 1028M+, sigh
<eam>
a = foo()
barttenbrinke has joined #ruby-lang
<eam>
well, sounds like the correct answer is to assume 1.8.7 just doesn't g
<eam>
gc
krohrbaugh has joined #ruby-lang
lsegal has joined #ruby-lang
adambeynon has joined #ruby-lang
krohrbaugh has quit [Ping timeout: 252 seconds]
sailias has quit [Ping timeout: 252 seconds]
weems has joined #ruby-lang
krohrbaugh has joined #ruby-lang
barttenbrinke has quit [Remote host closed the connection]
robbyoconnor has joined #ruby-lang
Nisstyre-laptop has quit [Quit: Leaving]
swav has joined #ruby-lang
Nisstyre-laptop has joined #ruby-lang
swav has quit [Ping timeout: 245 seconds]
tenderlove has joined #ruby-lang
justinmburrous has joined #ruby-lang
Fretta has joined #ruby-lang
bryanl has quit [Ping timeout: 245 seconds]
jvrmaia has quit [Remote host closed the connection]
Swimming_Bird has quit [Quit: Computer has gone to sleep.]
<whitequark>
yorickpeterse: wat? that's a different parser state
<whitequark>
expr_arg in my case, expr_beg in your case
<yorickpeterse>
I know
swav has joined #ruby-lang
<whitequark>
>> Output / foo /bar/
<eval-in>
whitequark => /tmp/execpad-24eba5955dbd/source-24eba5955dbd:2: syntax error, unexpected tREGEXP_BEG, expecting keyword_do or '{' or '(' ... (http://eval.in/30463)
<whitequark>
man I have no idea when it interprets stuff as regexp and when not
<whitequark>
time to consult the ISO std!
<yorickpeterse>
I wouldn't be surprised if it doesn't mention it
<whitequark>
it does, of course
tenderlo_ has joined #ruby-lang
<whitequark>
argh
<yorickpeterse>
I should get a hard cover copy and use it as weapon. Whenever somebody makes a comment about why something works weird I'll just smack them in the face with it
<yorickpeterse>
while yelling "BECAUSE RUBY, THAT'S WHY!"
tenderlove has quit [Ping timeout: 252 seconds]
Swimming_Bird has joined #ruby-lang
headius has joined #ruby-lang
cordax has joined #ruby-lang
retro|cz has quit [Remote host closed the connection]
robbyoconnor has quit [Ping timeout: 245 seconds]
Asher has quit [Read error: Connection reset by peer]
retro|cz has joined #ruby-lang
<apeiros>
aaaahaha, that'd be awesome yorickpeterse
Asher has joined #ruby-lang
blacktulip has quit [Remote host closed the connection]
athaeryn has joined #ruby-lang
JpC0utur3 has joined #ruby-lang
machuga is now known as machuga|away
hidalgo has quit [Ping timeout: 245 seconds]
pipework has quit [Remote host closed the connection]
ironcamel has quit [Quit: leaving]
rickhull has joined #ruby-lang
hidalgo has joined #ruby-lang
krohrbaugh has quit [Quit: Leaving.]
<ericwood>
ruby!
<ericwood>
<3
kstone has joined #ruby-lang
cordax has quit [Quit: Computer has gone to sleep.]
<whitequark>
there isn't a fucking word in the standard related to expr_arg.
<whitequark>
well, more precisely, there is a sentence about parsing of x -2 and x-2, but it's far from explaining all the weirdness. and that's about it.
workmad3 has quit [Ping timeout: 260 seconds]
nathanstitt has quit [Quit: I growing sleepy]
<apeiros>
athaeryn: nice idea
<apeiros>
not sure I like the aliasing, though
<athaeryn>
apeiros: what would you recommend?
<apeiros>
I have no idea. If I had one, I'd tell you :-/
<athaeryn>
apeiros: haha
symm- has quit [Read error: Connection reset by peer]
<apeiros>
I'd say `find` and `locate` are inadequate for this
<athaeryn>
I would have made it a gem but there's already one named leaf. :P
<athaeryn>
apeiros: what don't you like about the aliasing?
<apeiros>
no rationale. hence 'not sure'
<apeiros>
just feels wrong
<athaeryn>
Hmm... You could always just move things into your path somewhere, if you don't want to symlink.
<athaeryn>
I just habitually symlink things into ~/bin
<athaeryn>
apeiros: I'll admit that the whole set up is a little hacky, though.
<apeiros>
hu?
<apeiros>
not talking about symlinking
<apeiros>
I talk about the `alias git=leaf-collector`
<athaeryn>
apeiros: ah...
<drbrain>
Marshal has three ways to represent 0
<drbrain>
well, more
<athaeryn>
Some people calls symlinks aliases, and sometimes interchangeably, so I wasn't sure. :)P
<apeiros>
drbrain: identity crisis? I assume it's related to Bignum 0, -0 etc.?
* athaeryn
should ask instead of assuming next time
<drbrain>
apeiros: no, it's a hole in the encoding
pskosinski_ has joined #ruby-lang
pskosinski has quit [Remote host closed the connection]
Senjai has quit [Ping timeout: 245 seconds]
pskosinski_ is now known as pskosinski
<drbrain>
an integer is stored in a compressed form with two bits used to indicate the number of bytes the number uses up
<drbrain>
specifically, a C long
breakingthings has quit [Quit: breakingthings]
<drbrain>
so you end up with the equivalent of "positive 0" and "negative 0" and plain 0
<drbrain>
(the latter as "\x00")
<andrewvos>
How is positive 0 differrent from negative 0?
krohrbaugh1 has joined #ruby-lang
krohrbaugh1 has quit [Client Quit]
<apeiros>
one is good for you, the other isn't!
<apeiros>
one cheers you up, the other pulls you down!
<drbrain>
andrewvos: it's just one of three ways the compression plays out for a single-byte compressed integer
<apeiros>
it might also have to do with limes
crudson has joined #ruby-lang
<apeiros>
that's the latin limes, not the fruit
JpC0utur3 has joined #ruby-lang
justinmburrous has quit [Remote host closed the connection]
<andrewvos>
hahaha
krohrbaugh1 has joined #ruby-lang
enebo has quit [Quit: enebo]
<whitequark>
wait
krohrbaugh has quit [Ping timeout: 246 seconds]
<whitequark>
how is "plain 0" different from "positive 0"?!
<athaeryn>
whitequark: it's the beards.
<whitequark>
what the hell
<drbrain>
whitequark: the three possible ways 0 can be represented are: "\x04\x08i\x00", "\x04\x08\x05", "\x04\x08\xfb"
* whitequark
sighs
<drbrain>
oops, I forgot to add an i in for the last two
<whitequark>
drbrain: does it deserialize to three non-equal? bignums?
<drbrain>
they all decode to a ruby 0
<drbrain>
whitequark: they all decode to the Fixnum 0
<whitequark>
drbrain: oh I see... then it's just non-canonical encodings
<drbrain>
yeah
<whitequark>
not as bad as I thought
<eam>
long doesn't have positive and negative zero -- float does though
Markvilla has joined #ruby-lang
<drbrain>
ruby will never generate anything but i\x00 for the Fixnum 0
mistym has quit [Remote host closed the connection]
<drbrain>
whitequark: I think the largest bignum Marshal can store is 4GB long
<athaeryn>
apeiros: yeah, I can't think of a good alternative to aliasing. You could maybe alias it to glit or something, and then use that in place of git, but that would be really annoying and not practical. :/
<whitequark>
drbrain: that is quite a bit of digits. :D
<drbrain>
yeah
JpC0utur3 has quit [Ping timeout: 264 seconds]
<apeiros>
athaeryn: well, in my case I'd just realias all my existing git related aliases, I guess
<athaeryn>
apeiros: why would you need to do that?
fosky has joined #ruby-lang
<apeiros>
leave git untouched, unaliased
<apeiros>
not need, but prefer.
<whitequark>
aliae
<whitequark>
are coming
<athaeryn>
apeiros: Well, yeah, I guess if it bothers you to alias git. :)P
elia has joined #ruby-lang
tenderlo_ has quit [Ping timeout: 245 seconds]
tenderlove has joined #ruby-lang
lupine has quit [Read error: Connection reset by peer]
lupine has joined #ruby-lang
mbj has quit [Quit: leaving]
mbj has joined #ruby-lang
Swimming_Bird has quit [Quit: Computer has gone to sleep.]
headius has quit [Quit: headius]
justinmburrous has joined #ruby-lang
headius has joined #ruby-lang
redyellowgreen has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
athaeryn has quit [Remote host closed the connection]
lguardiola has quit [Remote host closed the connection]
outoftime has quit [Quit: outoftime]
swav has quit [Remote host closed the connection]
sailias has joined #ruby-lang
wallerdev has joined #ruby-lang
djwonk has quit [Quit: djwonk]
stamina has quit [Read error: Operation timed out]
sailias has quit [Quit: Leaving.]
benlovell has quit [Ping timeout: 248 seconds]
henrikhodne has quit [Quit: Computer has gone to sleep.]
emptyflask has joined #ruby-lang
emptyflask has quit [Remote host closed the connection]
solars has quit [Ping timeout: 256 seconds]
mbj has quit [Ping timeout: 248 seconds]
mbj has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
nighthwk1 has joined #ruby-lang
nighthwk1 has quit [Remote host closed the connection]
headius has quit [Quit: headius]
mbj has quit [Ping timeout: 252 seconds]
breakingthings has joined #ruby-lang
aleo_ has quit [Ping timeout: 252 seconds]
redyellowgreen has joined #ruby-lang
io_syl has quit [Ping timeout: 245 seconds]
benlovell has joined #ruby-lang
woollyams has joined #ruby-lang
S1kx has quit [Quit: Leaving]
nathanstitt has joined #ruby-lang
havenwood has joined #ruby-lang
rsync has joined #ruby-lang
cwd1 has joined #ruby-lang
Swimming_Bird has joined #ruby-lang
benlovell has quit [Ping timeout: 248 seconds]
retro|cz has quit [Ping timeout: 260 seconds]
DomKM has quit [Quit: Leaving.]
tbuehlmann has quit [Remote host closed the connection]
krohrbaugh1 has quit [Quit: Leaving.]
krohrbaugh has joined #ruby-lang
machuga|away is now known as machuga
geopet has quit [Quit: geopet]
hashkey has quit []
Nisstyre-laptop has quit [Ping timeout: 245 seconds]