Sam Saffron

samsaffron.com · Personal blog · on HN since 2009

Sam Saffron, a co-founder of Discourse and former Stack Overflow developer, writes about Ruby and .NET performance, memory, and Rails internals.

What HN saysCommenters call his write-ups great and call his Ruby 2.1 garbage collection article a must-read; his Stack Overflow .NET GC post is cited for scaling GC languages.
51HN people shared it
22linked it in comments
49stories submitted
3.1Kstory points
11 months agolast shared
2009people per year2026

Most-shared posts

  1. 1
    How I learned to stop worrying and write my own ORM
    7 people · 18 points · first shared 2011 · 6 comments on HN
  2. 2
    WebSockets: caution required
    4 people · 229 points · first shared 2015 · 110 comments on HN
  3. 3
  4. 4
    Stop Paying Your jQuery Tax
    3 people · 357 points · first shared 2012 · 84 comments on HN
  5. 5
    Ruby 2.1 Garbage Collection: ready for production
    3 people · 204 points · first shared 2014 · 38 comments on HN
  6. 6
    Debugging hidden memory leaks in Ruby
    3 people · 103 points · first shared 2019 · 8 comments on HN
  7. 7
    Eliminating my trivial inconveniences building Discourse
    3 people · 77 points · first shared 2013 · 37 comments on HN
  8. 8
    An analysis of memory bloat in Active Record 5.2
    3 people · 5 points · first shared 2018 · discussion on HN
  9. 9
  10. 10
    Speeding up Rails 4.2
    2 people · 197 points · first shared 2014 · 16 comments on HN
  11. 11
  12. 12
    A day in the life of a slow page at Stack Overflow
    2 people · 18 points · first shared 2011 · discussion on HN
  13. 13
  14. 14
    Announcing rubybench.org
    2 people · 8 points · first shared 2015 · discussion on HN
  15. 15
    Ruby's external malloc problem
    2 people · 5 points · first shared 2018 · 1 comments on HN

What HN people wrote when they linked it

ghiculescu · 2014-12-20
I found http://samsaffron.com/archive/2014/12/01/speeding-up-rails-4-2 (from the post's comments) interesting. It looks like there were initially quite a few performance regressions in the new release. Adequate Record looks great for rails scaffolds, but (at this stage) doesn't look like it will very useful for production apps that probably have more complex queries. For example, it stops working if your query has a `where`. Big thanks to Sam et al for their work in speeding things up.
VeejayRampay · 2014-12-01
Sam Saffron has great write-ups. His article on Ruby 2.1 and garbage collection fine-tuning [1] is a must-read [1] http://samsaffron.com/archive/2014/04/08/ruby-2-1-garbage-collection-r…
sams99 · 2013-11-29
Sam here from Discourse, I use Discourse to drive commenting on my blog and I love it, ever since I did it comment quality has gone way up. eg: http://samsaffron.com/archive/2013/11/22/demystifying-the-ruby-gc#comm… , one could build a plugin that gives parity with disqus, its just a space we have not really decided to enter
klodolph · 2013-03-01
> As for GC, it would be nice to have good real time GCs in runtimes. After decades of GC research, I think the conclusion is, "Yeah, that would be nice." Current state of the art gives us some very nice GCs that penalize either throughput or predictability. One of my favorite stories about GC is here: http://samsaffron.com/archive/2011/10/28/in-managed-code-we-trust-our-…
dazbradbury · 2012-04-22
Here is an article discussing Stack Overflow's battle with the .Net Garbage Collector. It covers discovery through to their solutions, a good read for those interested in scaling code in GC languages. http://samsaffron.com/archive/2011/10/28/in-managed-code-we-trust-our-…
spicyj · 2011-06-26
In his announcement of the MVC Mini Profiler that this is based on, Sam Saffron writes unencouragingly: > Our open-source profiler is perhaps the best and most comprehensive production web page profiler out there for any web platform. (http://samsaffron.com/archive/2011/06/09/+Profiling+your+website+like+… New Relic (http://newrelic.com/) provides somewhat-similar tracking for Rails as a paid service.
ksec · 2019-04-09
1. I don't quite understand why people love Rust. I have nothing against it but I just don't quite get why the love. I viewed it as Modern C++ with Memory Management done right from Engineering perspective and elegant syntax with package management done right from the beginning. And may be just my circle or reading list, many Rubyist jumped to Rust, and more often after trying a few times and clicked, they felt in love with it. 2. Ruby = Rails. ~8.5% of Ruby Developers and there are 8.2% of Rails Developers. 3. Ruby / Rails are for many years split in love and dreaded languages and framework. ~50% on both side. I don't see any other languages and framework has similar pattern. 4. There are more Django / Laravel developers than Ruby Rails. 5. ~60% of Developers are on Windows. That was obvious right? And yet Ruby / Rails Community has ignore the Windows as a development platform for years. [1] My guess it is the lack of resources. 6. Speaking of Resources, Ruby is the top programming language that is surviving without a Major Cooperation ( Facebook, Amazon, Microsoft, Google, Apple ) backing. 7. Ruby 's Median salary, comparatively speaking is trending on the higher side. And also one of the highest with respective of lower years of experience. That is both good and bad. Developers get higher salary, but less company are willing to choose it for cost reason. 8. Am I correct to assume those Salaries exclude any Stock grant? Which is common in US? 9. Visual Studio Code…
codinghorror · 2018-06-04
> It's the Rails convenience stuff which slows things down massively. Yeah no kidding.. https://samsaffron.com/archive/2018/06/01/an-analysis-of-memory-bloat-…
teh_klev · 2016-11-13
It was Sam Saffron, one of the ex Stack Overflow and now Discourse developers that turned me on to it: https://samsaffron.com/archive/2013/05/03/eliminating-my-trivial-incon…
psyc · 2016-10-29
Any GC that walks the graph, and isn't mostly concurrent. You will know when the graph becomes complex enough, because thereafter the GC will not let you ignore it. In my experience, as few as several hundred thousand objects can become a problem. Imagine trying to write a responsive 3D modeling app with vertices, edges, and faces all bidirectionally pointing to each other. You the programmer would think very carefully before fully traversing such a data structure (much of the point of having thorough internal references is avoiding doing much traversal!), and yet the runtime helpfully does it for you, automatically, and there's nothing you can do to stop it. https://samsaffron.com/archive/2011/10/28/in-managed-code-we-trust-our… http://stackoverflow.com/a/14277068
j_s · 2016-07-07
I think Brotli is getting there, with support in Firefox and Chrome so far. https://samsaffron.com/archive/2016/06/15/the-current-state-of-brotli-…
Shog9 · 2015-11-23
Quality means many things... When it comes to the experience of the people using the site, performance - how long it takes the requested page to display - is critical; the vast majority of Stack Overflow's page requests are someone requesting a page that they urgently need to read. That doesn't preclude other aspects of quality of course. But it does influence how they're approached. A heavily abstracted system that hurts performance is unacceptable, but there are other ways to achieve the same ends. You might find this article interesting... http://samsaffron.com/archive/2011/03/30/How+I+learned+to+stop+worryin…
pkmiec · 2015-01-22
I originally read about this patch here, http://samsaffron.com/archive/2014/04/08/ruby-2-1-garbage-collection-r… There hasn't been any activity on the upstream proposal for almost a year. Has the core team rejected the idea or is there still hope it will make it into a future version?
gavingmiller · 2014-12-01
Sam has also blogged about this for Ruby specifically: http://samsaffron.com/archive/2013/12/11/call-to-action-long-running-r…
df07 · 2014-05-12
Try Dapper for a simple .NET ORM. We created and use it for Stack Overflow. https://code.google.com/p/dapper-dot-net/ Here's the original post describing how we made it: http://samsaffron.com/archive/2011/03/30/How+I+learned+to+stop+worryin…
burgerbrain · 2012-03-05
http://samsaffron.com/archive/2012/02/17/stop-paying-your-jquery-tax Apparently Stack Overflow sees similar numbers.
revetkn · 2011-11-16
The other part of this is throwing out the ORM in places where performance matters and replacing it with a simple utility, Dapper, that maps SQL to objects: http://samsaffron.com/archive/2011/03/30/How+I+learned+to+stop+worryin…
lucisferre · 2011-10-24
This solution seems extreme, given the GC is just a reality of working with managed languages which is most of the web these days (.NET, Java, Ruby, etc.). Many, many heavy traffic websites solve these problems without resorting to language magic tricks. Usually with effective use of caching, or separating out the heavily accessed data in a way that is is optimized for those read operations. This is the second StackExchange article where it feels like square peg, round hole. The first was [their ORM] (http://samsaffron.com/archive/2011/03/30/How+I+learned+to+stop+worryin… which isn't really an ORM at all (perhaps micro ORM is fair) in the traditional sense.
swanson · 2011-05-03
The linked article from Sam's blog: http://samsaffron.com/archive/2011/05/02/A+day+in+the+life+of+a+slow+p… I found it to be much more interesting and a cool look at how he went about actually finding the slowdown and the steps he took to fix it.
singular · 2011-04-05
The ORM is definitely very read-focused, which is probably not that surprising given that it's used for web, and given the motivations for creating it, discussed at the blog post mentioned by @gokhan [1]. It would be nice to have some lightweight stuff for updating/inserting too, though I guess doing it in such a way that you don't need to write lots of boilerplate kinda requires SQL generation, which dapper is avoiding on purpose. [1]: http://samsaffron.com/archive/2011/03/30/How+I+learned+to+stop+worryin…
tripzilch · 2012-03-05
Try http://m.twitter.com , it's the dressed-down mobile version of Twitter. It doesn't have all the features, but easily makes up for that by the fact that you can actually click around as much as you like without your browser getting all slumpy from loading huge pages or doing javascript. You'd expect caching to help, but there's a lot of truth in the jQuery tax article[1]: even if you got the code cached, executing it all takes a significant amount of time, and the sluggishness is made worse by the fact that during this time your CPU is busy, unlike with data transfers which at most cost some memory. I don't use the m.twitter.com site all the time, but I switch often enough whenever I get too annoyed by default Twitter's slowness. The only real downside (for me) is that you can't click through to a full resolution version of a profile picture. Otherwise all the basic features are in there. [1] http://samsaffron.com/archive/2012/02/17/stop-paying-your-jquery-tax

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close