Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Jason Frey
    @Fryguy
    and I think there are a few in some of the gems like ui-classic
    Chris Arcand
    @chrisarcand
    @jrafanie That's standard Rails; all the root stuff is Pathname, and you can basically give anything that implements to_path to require
    Not to mention that both @Fryguy and myself pressure people to use Pathname whenever possible :smirk:
    Joe Rafaniello
    @jrafanie
    yeah, I do too... :laughing:
    Chris Arcand
    @chrisarcand
    Prolly my fave standard lib. Stellar API.
    Jason Frey
    @Fryguy
    I bet if we count them there are probably 12 paths @jrafanie :moneybag:
    Joe Rafaniello
    @jrafanie
    irb(main):003:0> Rails.application.config.autoload_paths.length
    => 11
    Jason Frey
    @Fryguy
    soooo close
    Joe Rafaniello
    @jrafanie
    I left off the last path for savings ;-)
    Jason Frey
    @Fryguy
    HAHA
    Joe Rafaniello
    @jrafanie
    I want to make the vanilla rails slow again (like us)
    and leaky
    Joe Rafaniello
    @jrafanie
    nice @Fryguy... closer
    Jason Frey
    @Fryguy
    ?
    Joe Rafaniello
    @jrafanie
    on vanilla rails app with 11 autoload Pathames
    Measure Mode: wall_time
    Thread ID: 18018620
    Fiber ID: 22283900
    Total: 14.033344
    Sort by: self_time
    
     %self      total      self      wait     child     calls  name
     67.27      9.441     9.441     0.000     0.000      300   <Module::GC>#start
     23.42      4.127     3.287     0.000     0.839    90000   Kernel#require
      2.97      0.839     0.416     0.000     0.423   900000   Pathname#to_path
      1.86      0.423     0.261     0.000     0.162   900000   Kernel#initialize_dup
      1.42      4.429     0.200     0.000     4.229    90000   ActiveSupport::Dependencies::Loadable#load_dependency
      1.16      0.162     0.162     0.000     0.000   900000   String#initialize_copy
      0.58      4.510     0.081     0.000     4.429    90000   ActiveSupport::Dependencies::Loadable#require
      0.41      0.103     0.058     0.000     0.045    90000   ActiveSupport::Dependencies#load?
      0.32      0.045     0.045     0.000     0.000    90000   <Module::ActiveSupport::Dependencies>#mechanism
      0.02     14.033     0.002     0.000    14.031      301  *Integer#times
      0.00     14.033     0.000     0.000    14.033        1   [global]#[no method]
      0.00      0.000     0.000     0.000     0.000        2   IO#set_encoding
    The numbers don't match but at least we have pathnames
    Jason Frey
    @Fryguy
    yup
    Nick LaMuro
    @NickLaMuro
    @jrafanie when are you triggering ruby prof?
    Jason Frey
    @Fryguy
    @jrafanie try 12 Pathnames ;)
    Joe Rafaniello
    @jrafanie
    @NickLaMuro
    [root@localhost test_zomg]# cat test.rb
    require 'ruby-prof'
    require './config/environment'
    puts Process.pid
    f = './empty'
    RubyProf.start
    300.times { 300.times { require f }; GC.start }
    result = RubyProf.stop
    printer = RubyProf::FlatPrinter.new(result)
    printer.print(STDOUT)
    Oh well, I'm done for now, I'll probably look again a bit later
    Jason Frey
    @Fryguy
    :microphone: :droplet:
    Nick LaMuro
    @NickLaMuro

    So, this is pretty rough and blobby at the moment, but this is what I have been working on most of today, and a bit of yesterday:

    NickLaMuro/miq_tools@a078165

    Basically, I can attach to a running ruby process using gdb, and use this script to monitor each malloc, calloc, etc that is made, and determine where in the ruby and c-stack they are being called from
    here is an example call from the script we have been testing with that is looping and calling require 'linux_admin' (though, it was triggered by doing a ruby_eval "MiqSystem.num_cpus" in gdb... but same diff):
    Screen Shot 2018-01-16 at 9.47.32 PM.png
    That specific malloc line happens 6 times in the require call, and the ruby line doesn't change either. Not terribly surprising, but I guess I was expecting to see something in there besides ActiveSupport, and I didn't.
    Nick LaMuro
    @NickLaMuro
    the rb_expand_load_path though seems suspect (based on a previous discussion), and I will have to dive into the source tomorrow to see what is up, but that will have to wait until tomorrow
    night
    Jason Frey
    @Fryguy
    @NickLaMuro total aside...I was reading this article just now about Rust, and coincindentally the author talks about using Rust to create Ruby profiler that extracts stack traces with only access to the PID and memory maps... https://jvns.ca/blog/2018/01/13/rust-in-2018--way-easier-to-use/
    (it doesn't go deeper than that...just thought it was an interesting coincidence)
    Keenan Brock
    @kbrock
    nice - that is basically why yehuda is touting rust - for https://www.skylight.io/
    Nick LaMuro
    @NickLaMuro
    @Fryguy no, she was the one that mentioned on twitter that she was going on sabbatical for writing a ruby profiler
    also, I had this old article of her's up as well: https://jvns.ca/blog/2016/06/12/a-weird-system-call-process-vm-readv/
    which mentions this ariticle which I got a lot of the above for
    but yes, I assume it was all co-winky-dink
    NickLaMuro @NickLaMuro has a chrome tab problem
    Jason Frey
    @Fryguy
    @NickLaMuro oh yeah?
    rails.bad 2018-01-17 12-04-44.png
    Nick LaMuro
    @NickLaMuro
    but do you have multiple windows of chrome open?
    also, shameless self plug for my S***ty javascript: gist
    Jason Frey
    @Fryguy
    haha I had one of those pop-up gmail windows open..does that count?
    Nick LaMuro
    @NickLaMuro
    well, with that, I have 6 windows open, and 123 tabs open
    Jason Frey
    @Fryguy
    ༼ ༎ຶ ෴ ༎ຶ༽ you win
    Nick LaMuro
    @NickLaMuro
    I have been close to 300 at one point :cry:
    the reason I close is mostly because of "hey, I am really using a lot of swap huh... probably should fix that..."
    Keenan Brock
    @kbrock
    I sometimes bookmark all tabs (put a date in it -knowing I'll never come back)
    best way of declaring tab bankrupcy with fooling myself that I'm not doing that
    Nick LaMuro
    @NickLaMuro
    a lot of it ends up being documentation, which I am trying to push down into my terminal when possible