3 ms·
I think implementing shapes is very likely to significantly improve the raw compute speed of Ruby applications. That said, if you're implementing an applicatio
by dwheeler 4y ago
I think implementing shapes is very likely to significantly improve the raw compute speed of Ruby applications.
That said, if you're implementing an application in Rails, there are a number of low-hanging fruit that will significantly improve performance. In most cases they'd apply in any language, but since it's trivial to get "something running" in Rails, it's easy to forget the basics for performance. E.g.:
* Index your database for all queries that matter.
* Use caches. In the case of Rails, use partials; they are amazingly effective at improving performance.
* Use a tool to detect N+1 queries, and fix them.
* When querying with an ORM (ActiveRecord in Rails), request just the specific fields you need instead of "downloading everything" into the object. Getting unnecessary fields increases the database response, the memory use, and the garbage collection effort, and all of that unnecessary work eventually adds up.
In general, you can get a lot of performance improvements by doing only what needs to be done and nothing else. Caching to avoid repeated work, requesting only the data you need, etc., can provide a lot of performance improvement and often require relatively little effort.