slawrence00 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
chouhoulis has joined #ruby-lang
Ropeney has joined #ruby-lang
aaeron has quit [Quit: aaeron]
aaeron has joined #ruby-lang
bruno- has quit [Ping timeout: 250 seconds]
ruby-lang304 has joined #ruby-lang
wallerdev has joined #ruby-lang
joaomdmoura has quit [Remote host closed the connection]
jo__ has quit [Quit: Connection closed for inactivity]
cryptarium has quit [Ping timeout: 276 seconds]
aaeron has quit [Quit: aaeron]
joaomdmoura has joined #ruby-lang
RobertBirnie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ascarter_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
aaeron has joined #ruby-lang
dorei has quit []
alestuber has quit [Remote host closed the connection]
sankaber has joined #ruby-lang
Fooster has joined #ruby-lang
joaomdmoura has quit [Read error: Connection reset by peer]
joaomdmoura has joined #ruby-lang
hahuang65 has quit [Ping timeout: 256 seconds]
Fooster has quit [Ping timeout: 272 seconds]
that1guy has quit [Ping timeout: 276 seconds]
that1guy has joined #ruby-lang
stardiviner has quit [Quit: Weird in coding now, or make love, only two things push me away from IRC.]
joaomdmoura has quit [Read error: Connection reset by peer]
stardiviner has joined #ruby-lang
joaomdmoura has joined #ruby-lang
charliesome has joined #ruby-lang
ascarter has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
that1guy has quit [Ping timeout: 244 seconds]
rubyaw has joined #ruby-lang
joaomdmo_ has joined #ruby-lang
joaomdmoura has quit [Read error: Connection reset by peer]
joaomdmo_ has quit [Read error: Connection reset by peer]
joaomdmoura has joined #ruby-lang
rubyaw has quit [Quit: Leaving...]
baweaver has joined #ruby-lang
baweaver has quit [Remote host closed the connection]
baweaver has joined #ruby-lang
rubyaw has joined #ruby-lang
delongG__ has quit [Remote host closed the connection]
ascarter has joined #ruby-lang
joaomdmo_ has joined #ruby-lang
ascarter_ has joined #ruby-lang
joaomdmoura has quit [Ping timeout: 245 seconds]
yfeldblum has joined #ruby-lang
shinnya has quit [Ping timeout: 256 seconds]
wallerdev has quit [Ping timeout: 240 seconds]
crankharder has joined #ruby-lang
joaomdmo_ has quit [Read error: Connection reset by peer]
joaomdmoura has joined #ruby-lang
ascarter has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
rubyaw has quit [Quit: Leaving...]
bruno- has joined #ruby-lang
rubyaw has joined #ruby-lang
ruby-lang852 has joined #ruby-lang
ruby-lang852 has quit [Client Quit]
bruno- has quit [Ping timeout: 256 seconds]
programhappy has joined #ruby-lang
amclain has joined #ruby-lang
crankhar1er has joined #ruby-lang
programhappy has quit [Client Quit]
baweaver has quit [Read error: Connection reset by peer]
workmad3 has joined #ruby-lang
baweaver has joined #ruby-lang
unreal_ has joined #ruby-lang
unreal has quit [Ping timeout: 256 seconds]
ruby-lang061 has joined #ruby-lang
programhappy has joined #ruby-lang
workmad3 has quit [Ping timeout: 240 seconds]
baweaver has quit [Ping timeout: 244 seconds]
ruby-lang061 has quit [Client Quit]
crankhar1er has quit [Ping timeout: 272 seconds]
bungoman_ has joined #ruby-lang
hendranata_ has joined #ruby-lang
bungoman has quit [Ping timeout: 244 seconds]
that1guy has joined #ruby-lang
rubyaw has quit [Quit: Leaving...]
bungoman_ has quit [Ping timeout: 256 seconds]
ascarter_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
joaomdmoura has quit [Read error: Connection reset by peer]
joaomdmoura has joined #ruby-lang
ur5us has quit [Remote host closed the connection]
programhappy has quit [Quit: programhappy]
ur5us has joined #ruby-lang
fujimura has joined #ruby-lang
gix has quit [Ping timeout: 255 seconds]
symm- has quit [Ping timeout: 256 seconds]
gix has joined #ruby-lang
rubyaw has joined #ruby-lang
crankharder has quit [Quit: leaving]
crankharder has joined #ruby-lang
Agent604 has joined #ruby-lang
gambl0re has joined #ruby-lang
tkuchiki has joined #ruby-lang
sankaber has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jacaballero has joined #ruby-lang
michaelfisher has joined #ruby-lang
chouhoulis has quit []
michaelfisher has quit [Client Quit]
mphfish_ has joined #ruby-lang
joaomdmoura has quit [Read error: Connection reset by peer]
joaomdmoura has joined #ruby-lang
mphfish_ has quit [Client Quit]
Namaste_ has quit [Quit: You're a LOSER, and your dad probably beat you when you were a kid... which was probably two weeks ago]
joaomdmoura has quit [Read error: Connection reset by peer]
joaomdmo_ has joined #ruby-lang
joaomdmo_ has quit [Remote host closed the connection]
joaomdmoura has joined #ruby-lang
joaomdmoura has quit [Remote host closed the connection]
auzty has joined #ruby-lang
ruby-lang304 has quit [Ping timeout: 246 seconds]
hahuang65 has joined #ruby-lang
sunaku has joined #ruby-lang
stardiviner has quit [Ping timeout: 256 seconds]
senor_jalapeno has joined #ruby-lang
harlen has joined #ruby-lang
kwd has quit [Remote host closed the connection]
bturker has joined #ruby-lang
dvlwrk has quit [Ping timeout: 256 seconds]
stardiviner has joined #ruby-lang
joaomdmoura has joined #ruby-lang
bruno- has joined #ruby-lang
bruno- has quit [Ping timeout: 240 seconds]
aaeron has quit [Quit: aaeron]
workmad3 has joined #ruby-lang
workmad3 has quit [Ping timeout: 240 seconds]
Jaood has joined #ruby-lang
fujimura has quit [Remote host closed the connection]
Jaood has left #ruby-lang [#ruby-lang]
rbowlby_ has joined #ruby-lang
that1guy has quit [Ping timeout: 265 seconds]
ruby-lang725 has joined #ruby-lang
senor_jalapeno has quit [Ping timeout: 245 seconds]
rbowlby_ has quit [Client Quit]
<ruby-lang725>
hello rubyist, i'm on windows + ruby gems and when i run my NET::HTTP.post_form , I get "read server certificate B: certificate verify failed".
<ruby-lang725>
im trying to POST a https url
charliesome has quit [Quit: zzz]
<ruby-lang725>
How can i set the CA_PATH ? if i never initialize the HTTP object. I'm doing a one line call Net::HTTP.post_form(url, params)
tkuchiki has quit [Remote host closed the connection]
tkuchiki has joined #ruby-lang
gix has joined #ruby-lang
houhoulis has joined #ruby-lang
tkuchiki has quit [Ping timeout: 246 seconds]
michael_mbp has quit [Excess Flood]
tkuchiki has joined #ruby-lang
michael_mbp has joined #ruby-lang
tectonic has joined #ruby-lang
ruby-lang725 has quit [Ping timeout: 246 seconds]
Fooster has joined #ruby-lang
tkuchiki has quit [Remote host closed the connection]
Fooster has quit [Ping timeout: 264 seconds]
tkuchiki has joined #ruby-lang
tkuchiki has quit [Remote host closed the connection]
that1guy has quit [Ping timeout: 250 seconds]
tkuchiki has joined #ruby-lang
ogpastaling has joined #ruby-lang
fujimura has joined #ruby-lang
that1guy has joined #ruby-lang
fujimura has quit [Ping timeout: 256 seconds]
fujimura has joined #ruby-lang
djbkd has quit [Remote host closed the connection]
duderonomy has joined #ruby-lang
tectonic has quit []
womble has quit [Excess Flood]
womble has joined #ruby-lang
houhoulis has quit [Remote host closed the connection]
charliesome has quit [Quit: zzz]
fedexo has joined #ruby-lang
ogpastaling has quit [Remote host closed the connection]
charliesome has joined #ruby-lang
dellavg_ has joined #ruby-lang
That1Guy_ has joined #ruby-lang
mikecmpbll has quit [Quit: ciao.]
philoserf has joined #ruby-lang
dellavg_ has quit [Ping timeout: 264 seconds]
philoserf has quit [Remote host closed the connection]
bungoman has quit [Remote host closed the connection]
That1Guy_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
That1Guy_ has joined #ruby-lang
That1Guy_ has quit [Client Quit]
sunaku has quit [Ping timeout: 272 seconds]
that1guy has quit [Ping timeout: 264 seconds]
joaomdmoura has quit [Remote host closed the connection]
riotjones has joined #ruby-lang
hahuang65 has quit [Ping timeout: 246 seconds]
allomov has joined #ruby-lang
riotjones has quit [Ping timeout: 252 seconds]
that1guy has joined #ruby-lang
him has joined #ruby-lang
|jemc|_ has quit [Ping timeout: 256 seconds]
jas02 has joined #ruby-lang
djbkd has joined #ruby-lang
that1guy has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
haraoka has joined #ruby-lang
djbkd has quit [Ping timeout: 244 seconds]
him has quit [Ping timeout: 272 seconds]
hendranata_ has quit [Quit: Leaving]
djbkd has joined #ruby-lang
|jemc|_ has joined #ruby-lang
djellemah has joined #ruby-lang
Ropeney has quit [Ping timeout: 244 seconds]
jas02 has quit [Quit: jas02]
djbkd has quit [Ping timeout: 272 seconds]
allomov has quit [Remote host closed the connection]
hahuang65 has joined #ruby-lang
jas02 has joined #ruby-lang
JoshuaPaling has joined #ruby-lang
yfeldblum has quit [Remote host closed the connection]
yfeldblum has joined #ruby-lang
fedexo has quit [Ping timeout: 256 seconds]
allomov has joined #ruby-lang
t0rrieri has joined #ruby-lang
riotjones has joined #ruby-lang
Torrieri has quit [Ping timeout: 252 seconds]
hendranata_ has joined #ruby-lang
AlexAltea has joined #ruby-lang
jacaballero has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
|jemc|_ has quit [Ping timeout: 246 seconds]
ta has quit [Remote host closed the connection]
allomov has quit [Remote host closed the connection]
djbkd has joined #ruby-lang
ur5us has quit [Remote host closed the connection]
skade has joined #ruby-lang
bruno- has joined #ruby-lang
bruno- has quit [Ping timeout: 245 seconds]
allomov has joined #ruby-lang
ur5us has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
workmad3 has joined #ruby-lang
skade has joined #ruby-lang
amclain has quit [Quit: Leaving]
workmad3 has quit [Ping timeout: 252 seconds]
djbkd has quit []
rippa has joined #ruby-lang
bertocode has joined #ruby-lang
solars has joined #ruby-lang
kwd has joined #ruby-lang
jas02 has quit [Quit: jas02]
jas02 has joined #ruby-lang
hemanthsoni has joined #ruby-lang
<hemanthsoni>
hey guys, i'm a newbie ruby dev trying one of the basic challenges on hackerrank and i cant seem to figure out what i'm doing wrong - is this a good place to ask for help?
bturker has quit [Remote host closed the connection]
<hemanthsoni>
but then in another test case, my code returns two every time, instead of the right answer: http://h.soni.im/1FQTDoR
<hemanthsoni>
and i seriously have no idea why
ta has joined #ruby-lang
hendranata_ has quit [Ping timeout: 246 seconds]
futilegames has joined #ruby-lang
Iskarlar has joined #ruby-lang
kerunaru has joined #ruby-lang
<hemanthsoni>
damn :(
leat3 has quit [Remote host closed the connection]
leat3 has joined #ruby-lang
ta has quit [Read error: Connection reset by peer]
stan has joined #ruby-lang
ta has joined #ruby-lang
leat3 has quit [Ping timeout: 246 seconds]
stan has quit [Client Quit]
jas02 has quit [Quit: jas02]
jas02 has joined #ruby-lang
leat3 has joined #ruby-lang
stan has joined #ruby-lang
sepp2k has joined #ruby-lang
futilegames has quit [Quit: futilegames]
Fooster has joined #ruby-lang
<harlen>
that's a well presented quesiton. but which part of the ruby code are you having trouble with?
<hemanthsoni>
harlen - what do you mean by presented question?
<harlen>
i mean some people ask questions badkly without information. so that was good.
<hemanthsoni>
and it's understanding what i'm doing wrong - from looking through and trying to debug step by step, i feel like i am doing everything right
<harlen>
but are you having trouble with the algorithm, or are you confused about what the ruby code is doing?
<hemanthsoni>
i'm confused by the algorithm
leat3 has quit [Remote host closed the connection]
leat3 has joined #ruby-lang
<hemanthsoni>
so my code should be passing every digit in the range that the user inputs into a new array
<hemanthsoni>
(line 17 to 19
<harlen>
i'd write out why your code gave 2, and if you know or note why the expected output is 1.
<hemanthsoni>
yeah thats the thing, my code should not be outputting 2 from my understanding
<hemanthsoni>
the user inputs 1, 2, 2, 2, 1 as the original array
Fooster has quit [Ping timeout: 256 seconds]
<hemanthsoni>
then i pass the numbers in the index 1 to 4 into a new array
<hemanthsoni>
so those would be 2, 2, 2, and 1
<harlen>
i mean. you're question is either: "I don't know why my code gave 2." or "I don't know why it is meant to be 1, when the input is 1,4" or "i know why it is meant to be 1, and I know why my code gives 2. I don't know how to solve the problem."
<harlen>
which is it?
<hemanthsoni>
then i use .min to find the lowest number, which is obviously 1, yet somehow my code is returning 2!
<hemanthsoni>
ohhhh
<hemanthsoni>
it's the first one - i don't know why my code gave 2
<harlen>
gotchya. one sec i'll have a look.
<hemanthsoni>
thanks so much, this is driving me nuts
<hemanthsoni>
its 4am where i am, can't sleep till i understand what's wrong haha
marr has joined #ruby-lang
ledestin has joined #ruby-lang
sandelius has joined #ruby-lang
djbkd has joined #ruby-lang
stardiviner has quit [Ping timeout: 250 seconds]
djbkd has quit [Ping timeout: 256 seconds]
jas02 has quit [Quit: jas02]
Zen-Zen has quit [Ping timeout: 264 seconds]
kerunaru has quit [Ping timeout: 256 seconds]
znz_jp has quit [Quit: kill -QUIT $$]
<harlen>
width[x]
<harlen>
which element do you think that gets?
kfpratt has quit [Ping timeout: 244 seconds]
k3asd` has joined #ruby-lang
<ljarvis>
moin
<hemanthsoni>
width[x] gets whichever loop of the cycle i am
<hemanthsoni>
so if they array has 5 items in it and i input that i want from 1 to 4
<hemanthsoni>
it would give me the second, third, fourth, and fifth items in the array
<hemanthsoni>
check out the question, they already account for the fact that you are entering 1 to n, but arrays go from 0 to n
kfpratt has joined #ruby-lang
<harlen>
oh hey. i see it. you need to get the difference between .. and ...
<ruby-lang065>
ah okay, seems unneccesary to me... but I appreciate you guys making me write beautiful code :)
<ruby-lang065>
good habits are best learned early
charliesome has quit [Ping timeout: 256 seconds]
<ljarvis>
ruby-lang065: imagine that this code is part of a bigger codebase. A couple of 100k lines. Now imagine `numbers` is passed around in many places. If a method in one place mutates the contents then it could lead to confusion in another place (imagine these places being far far apart)
<ljarvis>
it's a bad hypothetical but you see my point
charliesome has joined #ruby-lang
<ruby-lang065>
yes I understand
<ruby-lang065>
Thank you for your help! I'll be back to codecademy
Fooster has joined #ruby-lang
fujimura has quit [Remote host closed the connection]
charliesome has quit [Ping timeout: 256 seconds]
sgambino has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tkuchiki has quit [Remote host closed the connection]
tkuchiki has joined #ruby-lang
bertocode has quit [Quit: Nettalk6 - www.ntalk.de]
<maloik>
xpost from ror as no one seems to know as usual, but how do you invoke a rake task in rails console that requires the rails env? Rake::Task['foo'].invoke tells me it doesnt know how to build task 'environment'
AugustoCesar has joined #ruby-lang
tkuchiki has quit [Ping timeout: 255 seconds]
AugustoCesar has quit [Client Quit]
kr3ssh has joined #ruby-lang
<yorickpeterse>
Unsure, but I'd argue it's dirty in the first place to call a Rake task from a console
<yorickpeterse>
comic solution: `rake foo`
<maloik>
I'm just trying to profile the task
<maloik>
wanted to try to avoid the overhead of ``
<maloik>
not that there'd be much but still
<maloik>
it sort of baffled me I couldnt just invoke it
<maloik>
Rails.application.load_tasks apparently
<maloik>
lol
kr3ssh has quit [Ping timeout: 265 seconds]
kr3ssh has joined #ruby-lang
<yorickpeterse>
meh, 25 lines of setup code for tests
<yorickpeterse>
I guess that's what I get for running a DB query involving 6 tables
<karma_>
That is not the URL you were looking for *sweeps hand over channel*
<yorickpeterse>
heh
fujimura has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
nofxx has quit [Ping timeout: 240 seconds]
harly has quit [Quit: Leaving]
skade has joined #ruby-lang
fujimura has quit [Ping timeout: 244 seconds]
kr3ssh has quit [Ping timeout: 264 seconds]
kr3ssh has joined #ruby-lang
symm- has joined #ruby-lang
<maloik>
yorickpeterse: to be clear that's the entire test, not just setup
<maloik>
still a terrible test to make changes to
<yorickpeterse>
ah
<maloik>
it basically forces you to write the feature, try it out by hand, then run the tests and adjust until they pass
<maloik>
writing the test first is close to impossible because you can never be sure what you did is correct :(
dzejrou has quit [Read error: Connection reset by peer]
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
imperator has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
rickrobs has joined #ruby-lang
rickrobs has quit [Remote host closed the connection]
rickrobs has joined #ruby-lang
DivineEntity has joined #ruby-lang
t0rrieri_ has quit [Read error: Connection reset by peer]
t0rrieri_ has joined #ruby-lang
workmad3 has quit [Ping timeout: 256 seconds]
sankaber has joined #ruby-lang
alestuber has joined #ruby-lang
alestuber has quit [Remote host closed the connection]
cryptarium has joined #ruby-lang
malconis has joined #ruby-lang
ridders has joined #ruby-lang
melter has quit [Quit: Client exiting]
allomov has quit [Remote host closed the connection]
cryptarium has quit [Quit: Leaving]
<ridders>
Hi I have an array which the objects have been pushed to it from reading the lines of a file. I have duplicate objects and need a new array containing just the unique ones, however when I try .uniq i get returned exactly the same list
stef204 has joined #ruby-lang
<ridders>
how can I resolve this?
<ljarvis>
ridders: you want a set
<ljarvis>
unless it's ordered I guess in which case that would make me question removing lines
<ljarvis>
is it ordered?
<ridders>
no not ordered. Only need the unique list for refering to to create a new file for each
<jds>
Nokogiri seems fairly heavy on my process's memory usage. Is there any sort of 'close' method that I'm supposed to be calling on the xml document?
<yorickpeterse>
why is there 200k LOC of XML?
<flavorjones>
jds: Can you provide an example?
fusillicode has quit [Quit: Leaving.]
<ljarvis>
^
<yorickpeterse>
jds: No, that's simply due to how DOM parsing works
<ljarvis>
yorickpeterse: the yaml and xml is related to fixtures
<yorickpeterse>
If you need to parse large documents either use the pull parsing API or the SAX API
fusillicode has joined #ruby-lang
<yorickpeterse>
ljarvis: ah
<yorickpeterse>
I thought you went all enterprise there for a moment
<yorickpeterse>
"oh those are just our WSDLs"
<ljarvis>
they include them :(
<ljarvis>
lots of soap
allomov has joined #ruby-lang
<yorickpeterse>
sounds dirty
<jds>
yorickpeterse: I'm finding (I think) that ruby's GC is reluctant to fully clean up the XML document after I've finished using it, I'm guessing because all the memory is held by libxml & so ruby doesn't think it's worth cleaning
<ljarvis>
jds: can you show an example?
<jds>
1 sec
<flavorjones>
jds: if you've really really stopped using any references to the document or things in the document, then things will get GCed
<flavorjones>
but, for example, if you retain a reference to a node, then the entire document will still be resident in memory.
<yorickpeterse>
jds: No, Nokogiri takes care of that
<yorickpeterse>
Either you still have references to the XML document somewhere, or your input is simply big enough that it uses a lot of memory
<ridders>
ljarvis: set is returning the objects like this <Set:0x25ba410>, I was under the impression that was a hash, and .to_s would resolve that and return it to a string, but it doesnt, why?
<ljarvis>
ridders: what are you looking for exactly?
<ljarvis>
you want a string?
<ridders>
yeah I need to return the string not the hash
<ljarvis>
are you writing this back out to another file or something?
<ridders>
yeah
<ridders>
will become filename
<ljarvis>
so `cat foo | uniq > bar` wouldn't suffice?
<ljarvis>
how big will the files be?
<ljarvis>
if you just want the set as a string you need to convert it to an array, i.e lines.to_a.join("\n") -- but if you do just want to copy one file to another removing duplicate lines there are better ways to go about it
<ridders>
the array didnt work when I needed to remove duplicates
<ljarvis>
yes, so you have a set with unique results, you can then convert that to an array so you can do array stuff on it
<ridders>
oh okay
<ljarvis>
again, though, that isn't optimal if you just want to copy one file to another and remove duplicate lines
<yorickpeterse>
hm, for rbx there's no significant difference
<yorickpeterse>
considering it caches things that's not entirely surprising
skade has quit [Client Quit]
<headius>
I don't remember if I ever saw improvement from respond_to caching because we have class-level caches too
<headius>
so it only saves a couple lookups
dellavg_ has quit [Ping timeout: 264 seconds]
<yorickpeterse>
well, in case of Oga it does a few million calls to respond_to?
<yorickpeterse>
Basically one call for every XML node (elements, text, etc) in the document
<yorickpeterse>
(at least in these benchmarks)
tubbo` has joined #ruby-lang
tubbo has quit [Read error: Connection reset by peer]
<headius>
9k with no extra flags looks to be about 2x MRI here
<headius>
on node_matches anyway
<headius>
going go try a couple other configurations
<headius>
we still don't JIT blocks so that can weird up numbers a little
joaomdmo_ has quit [Remote host closed the connection]
bungoman has joined #ruby-lang
<yorickpeterse>
For the xpath stuff there are also a ton of allocations happening, which I can only remove by rewriting substantial parts of it
joaomdmoura has joined #ruby-lang
<yorickpeterse>
basically now every method has its own local stack passed in as an argument
<yorickpeterse>
But often those objects aren't really used other than for iteration
<headius>
preallocate? reuse?
<yorickpeterse>
turning it into a proper stack based VM should reduce the amount of allocations quite heavily
<yorickpeterse>
(right now it's a bit of an odd mix between an AST runner and a stack machine)
<yorickpeterse>
But that's something for post 1.0 as it will take a few weeks to complete
allomov has quit [Remote host closed the connection]
<yorickpeterse>
in such a case I probably have to write a compiler too, raw XPath ASTs are quite painful to walk through
<chrisseaton>
yorickpeterse: can you JIT XPath to rbx bytecode from within an application running on rbx?
tubbo` has quit [Ping timeout: 244 seconds]
<headius>
woo, more like 3x with invokedynamic on
howdoicomputer_ has quit [Quit: howdoicomputer_]
<yorickpeterse>
chrisseaton: haha
<yorickpeterse>
Probably not, but it would be a fun feature: "* built-in JIT that compiles XPath to JRuby/Rubinius bytecode"
baweaver has joined #ruby-lang
<|jemc|>
sounds like a fun use for Module#dynamic_method :)
<chrisseaton>
yorickpeterse: I think sprintf in rbx JITs to bytecode already
<|jemc|>
pegleromyces uses that extensively
<headius>
okeedokee...time for some allocation profiling
<chrisseaton>
we're doing it for pack as well and it's great - we can inline and constant fold through it when it's been compiled
<yorickpeterse>
chrisseaton: the problem is that xpath relies on some pretty specific logic of which there are no instructions present
<headius>
I assume rbx bytecode is turing complete :-)
<|jemc|>
heh
<yorickpeterse>
might as well include inline x86 assembly then
<yorickpeterse>
can't get closer to the bear metal
nofxx has quit [Ping timeout: 272 seconds]
<chrisseaton>
yeah but my compiler can choose better instructions and scheduling than I can!
<chrisseaton>
Snippets like V8 do are great, but they don't compose - two snippets in sequence may not be as good as something that was generated for both operations by a compiler
<chrisseaton>
And your compiler can't constant fold inline assembly
<headius>
so many strings
<yorickpeterse>
headius: haha yeah
<yorickpeterse>
10mb of XML can produce quite the String allocations
<headius>
I did a full alloc histo for node_matches
<headius>
that's what I have at the moment... second result is indexed with no masgn and using #at
<headius>
MRI is indexed version too
<yorickpeterse>
hmm
alestuber has quit [Ping timeout: 250 seconds]
Fooster has quit [Ping timeout: 272 seconds]
woodruffw has quit [Quit: And then he took off.]
<yorickpeterse>
at least on MRI using [] shouldn't matter vs #at
woodruffw has joined #ruby-lang
<headius>
strangely, [] is a bit faster
<yorickpeterse>
since it delegates #[] to #at if the argument is a fixnum
<yorickpeterse>
IIRC
<headius>
actually it may be noise
<headius>
next run was slower
momomomomo has joined #ruby-lang
<yorickpeterse>
Yeah, running these benchmarks on a laptop/desktop doesn't always produce very accurate results
<yorickpeterse>
I should probably spin up an EC2 instance for this this weekend
<headius>
jruby doesn't suffer as much from [] as I expected, but it loses the gains
<darix>
yorickpeterse: so you have even more background noise to make your results "useful" ?:)
<headius>
so 15% forward, 15% back depending on impl
<yorickpeterse>
e.g. one time this benchmark runs with 1.1m i/s
<yorickpeterse>
then 756k i/s
<yorickpeterse>
darix: hush, EC2's network and virtualization is flawless
<darix>
yorickpeterse: turn off the cpu power mgmt maybe
<darix>
for more reliable results
<yorickpeterse>
I tend to still get jumps when I plug in my adapter
skade has joined #ruby-lang
alestuber has joined #ruby-lang
<yorickpeterse>
headius: did pre2 optimize anything regarding bootup times? It seems a lot faster to boot than pre1
<headius>
pre2 optimized many things
<yorickpeterse>
e.g. I remember that the extension compilation process of Oga used to take forever under jruby
<headius>
pre1 optimized very few things
<yorickpeterse>
ah
baweaver has joined #ruby-lang
workmad3 has quit [Ping timeout: 276 seconds]
<headius>
any pre1 numbers you have are likely way slower than they should be
<yorickpeterse>
I get around 2M i/s on JRuby 9k-pre2 for the name only bench
<yorickpeterse>
not bad
<headius>
java 7 or 8?
<headius>
oh, you probably didn't run with indy either
<yorickpeterse>
1.7
<yorickpeterse>
No, just stock options
<yorickpeterse>
interesting enough benchmark/xpath/evaluator/big_xml_average_bench.rb is actually about a second slower than MRI
<yorickpeterse>
hm, I wonder if replacing java7 with java8 messes things up
<headius>
something must be wrong with 1.7 for that bench
<headius>
indy is definitely faster on 9k.pre2... on java 9 it's over 2x faster than non-indy
skade has quit [Read error: Connection reset by peer]
<yorickpeterse>
allrighty, java8 installed
<headius>
I'm not really interested in 1.7 perf anymore, but that's interesting
skade has joined #ruby-lang
<yorickpeterse>
heh, using java8 it seems tue big XML benchmark is actually even slower
<yorickpeterse>
lemme try using invoke dynamic & friends
<yorickpeterse>
Ah, much better
<yorickpeterse>
now it's actually faster than MRI
<yorickpeterse>
That's using "jruby -Xcompile.invokedynamic=true -Xjit.threshold=0 benchmark/xpath/evaluator/big_xml_average_bench.rb"
<yorickpeterse>
(I get around 1,3 sec on JRuby)
imperator has quit [Quit: This computer has gone to sleep]
<headius>
nice
<yorickpeterse>
it's around 1,8 on MRI 2.2
<headius>
not faster enough for me :-)
<yorickpeterse>
oh yeah, I somewhere hope to get this under 500ms
<yorickpeterse>
but that will be quite difficult
<headius>
let's have a look at that one
ecnalyr has quit [Remote host closed the connection]
<yorickpeterse>
well, to achieve that I'd have to do some proper refactoring
<yorickpeterse>
Right now xpath queries result in more allocations than really needed
<headius>
after it warms up looks like about 6 young GCs per cycle
<yorickpeterse>
Not surprising, a lot of the objects are short lived
<yorickpeterse>
Rbx profiler output also shows most time being spent in the young GC
<headius>
well, we're not spending any time there
<headius>
6 young GCs works out to under 0.1s
<yorickpeterse>
(which IIRC is still stop-the-world-for-a-little-while)
<headius>
probably under 0.05 because it runs 8 threads
imperator2 has quit [Quit: Valete!]
<headius>
I'll try an alloc profile
joaomdmoura has joined #ruby-lang
<headius>
yorickpeterse: 1.7.21 and 9k.next will have the Symbol#== fix, if you'd rather not use #equals? there
<yorickpeterse>
Ah
<yorickpeterse>
well, I'm signing off for the night, need to make a bigger battle plan for this xpath stuff tomorrow seeing how I'm running out of possible micro optimizations
<yorickpeterse>
I really would like to just have a big red "MAKE WEBSCALE" button
<yorickpeterse>
like one of those old turbo buttons
<headius>
yorickpeterse: if I find anything that stands out in the big xml bench I'll let you know or file a PR
<headius>
seems like there's some good opportunities here, at least from what I can see in JRuby
<yorickpeterse>
oh yeah, I figure if somebody wants to benchmark their Ruby implementation they should run some Oga benchmarks
jacaballero has joined #ruby-lang
joaomdmoura has quit [Ping timeout: 240 seconds]
<yorickpeterse>
anyway, thanks for the help
<headius>
well, I've found two opportunities in JRuby already, so that's good :-)
<headius>
do these benchmarks have an equivalent for nokogiri, to compare?
whippythellama has quit [Quit: whippythellama]
<yorickpeterse>
headius: there's one which compares nokogiri, oga, ox and rexml
<headius>
zendrix: if FFI isn't too "3rd party" for you tou could call ito the C lib
<aewffwea>
headius: Hey, does JRuby run ruby code on Java bytecode directly? or Ruby runs on JRuby which runs on java bytecode?
<headius>
aewffwea: JRuby has an interpreter written in Java and a JIT that converts hot Ruby code into JVM bytecode
aaeron has joined #ruby-lang
<headius>
so both, I guess
<aewffwea>
headius: interesting... Do you know if any ruby code is elegible to be converted to bytecode? Or only a subset of ruby?
bungoman has quit [Ping timeout: 240 seconds]
<headius>
all ruby code can eventually become JVM bytecode, but obviously with varying levels of optimization depending on what it's doing
<headius>
the JIT only jits methods right now too, so if you save off a block and call it a bunch it might stay interpreted
<headius>
miles of opportunity to improve perf in 9k
<aewffwea>
headius: 9k?
duderonomy has quit [Ping timeout: 256 seconds]
<headius>
JRuby 9.0.0.0
<aewffwea>
ah, ok
<headius>
9th major release so we jumped from 1.x numbering
<aewffwea>
thanks for your info!
<headius>
any time
bungoman_ has quit [Ping timeout: 256 seconds]
atomical_ has quit [Ping timeout: 248 seconds]
nertzy has joined #ruby-lang
jacaballero has quit [Max SendQ exceeded]
<aewffwea>
headius: BTW: Do you contribute to Ruby or JRuby by any chance?
<headius>
aewffwea: both, in fact :-)
<bnagy>
kek
<headius>
but mostly JRuby
konr has joined #ruby-lang
delongG_ has quit [Remote host closed the connection]
bruno- has quit [Quit: Lost terminal]
<aewffwea>
headius: Wouldn't it be cool to have a Ruby interpreter written on Ruby? For that to work you'll of course need a Ruby to ASM kind of pipeline... Then you could
zendrix has quit [Remote host closed the connection]
<aewffwea>
end up having a completele Ruby IDE and environment written in ruby...
jacaballero has joined #ruby-lang
bruno- has joined #ruby-lang
delongG_ has joined #ruby-lang
<apeiros>
aewffwea: rubinius tried that
<zenspider>
heh
zendrix has joined #ruby-lang
<headius>
meta-circular is fashion if you ask me
<aewffwea>
apeiros: What happened?
<headius>
none of the really good production-scale VMs are meta-circular
<bnagy>
I still like rubinius
<bnagy>
LLVM is the future man, people need to get onboard
<aewffwea>
headius: There are different levels of "production-scale" xD
<darix>
bnagy: it isnt fully ruby either :p
<zenspider>
I really wish self had finished their rewrite before sun imploaded
<zenspider>
imploded ? imploded
<apeiros>
aewffwea: no idea. I didn't follow it closely.
<apeiros>
zenspider: self, the language?
<headius>
bnagy: llvm is nothing more than a code-generation library
<zenspider>
apeiros: aye. they were working on self in self. it would have been a really good emonstration that you CAN have production-scale VMs that are meta-circular.
<headius>
aewffwea: I'm sure the giant smalltalk community is happt to have it too :-)
<zenspider>
bad timing business wise killed that project off
<headius>
but I doubt it's faster than the non-meta smalltalks
<headius>
I doubt it's even close
<aewffwea>
headius: It will be eventually
<apeiros>
self seemed to be pretty awesome in some regards. only read a paper on it. been a while, though.
<aewffwea>
headius: To be honest, the Pharo thing is kind of a cheat...
<apeiros>
didn't they get pretty close to C's perf with an interpreter?
<apeiros>
or am I confusing languages again :D
<headius>
yeah but unfortunately you had to write Self
<aewffwea>
the way they implemented Pharo is by only using a very limited subset of Smalltalk that translates 1 to 1 to C code xD
alestuber has quit [Ping timeout: 256 seconds]
<headius>
yeah
<aewffwea>
you can't actually send messages in the VM implementation xD
<zenspider>
headius: better self than java :P
<aewffwea>
but well, it's still a lot better than C
stardiviner has joined #ruby-lang
<headius>
certainly better than C :-)
<headius>
I dunno, I guess I'm also not strongly on either side of dynamic/static debate
<aewffwea>
headius: What's the dynamic/static debate?
<headius>
static languages let me be more explicit in the code I right and have fewer perf gotchas
<headius>
that seems like a damn good thing to have in a language runtime
alestuber has joined #ruby-lang
<headius>
right=write
<apeiros>
I'd like some syntax to make assertions on params. otherwise I'm quite happy with dynamic. but I don't have a particularly hard time living with static either.
sunaku has quit [Ping timeout: 255 seconds]
<aewffwea>
headius: The problem with that debate, is that you actually don't need to choose...
<aewffwea>
headius: It's completely doable to have a language that it's both "static" and "dynamic"
<apeiros>
proper contracts in ruby would be awesome. due to lack of `old` you can't really build proper shims to do it
<headius>
yeah, I'd like to see static typing contracts or full-on gradual typing as part of Ruby 3
<aewffwea>
headius: You'll never get full mandatory static typing
<aewffwea>
headius: But you might get optional type annotations, which could give you basically the same result
Ropeney has joined #ruby-lang
<aewffwea>
headius: and a -force-types mode to force eveything to have type annotations
<headius>
aewffwea: that would be interesting
<headius>
I experimented with a statically-typed Ruby-like lang that also did dynamic dispatch
<headius>
it is not a bad mix
<headius>
Mirah
<headius>
I'm not sure current versions have the dynamic dispatch but it would be easy to add back
* darix
throws elixir into the mix
<aewffwea>
headius: People should start creating environments where everything if possible, instead of thinking that features are either or
<zenspider>
apeiros: you should see how racket is doing typed/racket and slowly folding it in and making it interop w/ untyped
<zenspider>
it's kinda nice... even if I don't like static typing
chadwtaylor has quit [Remote host closed the connection]
<headius>
yorickpeterse: allocation trace for big XML xpath evaluator bench is 1G of text, heh
delongG_ has quit [Remote host closed the connection]
jacaballero has quit [Ping timeout: 256 seconds]
tdy has joined #ruby-lang
skyrocker has quit [Read error: Connection reset by peer]
delongG_ has joined #ruby-lang
delongG_ has quit [Remote host closed the connection]
skyrocker has joined #ruby-lang
jacaballero has joined #ruby-lang
<headius>
yorickpeterse: org.libll.Driver$2.call(Driver.java:230) is responsible for the top couple entries
<headius>
creates an Array
jacaballero has quit [Client Quit]
bruno- has quit [Quit: Lost terminal]
bruno- has joined #ruby-lang
ecnalyr has joined #ruby-lang
apt-get_ has quit [Quit: Quit]
delongG_ has joined #ruby-lang
malconis has quit [Ping timeout: 264 seconds]
nertzy has quit [Quit: This computer has gone to sleep]
baweaver has quit [Remote host closed the connection]
Contigi777 has quit [Quit: Leaving]
joaomdmoura has joined #ruby-lang
cornerma1 has joined #ruby-lang
harlen has joined #ruby-lang
baweaver has joined #ruby-lang
cornerman has quit [Ping timeout: 250 seconds]
cornerma1 is now known as cornerman
ecnalyr has quit [Remote host closed the connection]
toretore has quit [Quit: This computer has gone to sleep]
joaomdmoura has quit [Ping timeout: 265 seconds]
aaeron has quit [Ping timeout: 240 seconds]
baweaver has quit [Remote host closed the connection]
aaeron has joined #ruby-lang
aaeron has quit [Client Quit]
delongG_ has quit [Remote host closed the connection]
aaeron has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
alestuber has quit [Remote host closed the connection]