Aditia Mahdar


kodelasut

Web Developer. Railsnoob. Freelancer

Feb 4, 2019

How to make Ruby on Rails app fast

The last point in that article is "Give Up", yes literally give up with Ruby on Rails, and try something else. Well maybe I should try to learn new language this year. #2019keluarzonanyaman

source: https://www.mskog.com/posts/42-performance-tips-for-ruby-on-rails/#puma-tuning

Jan 27, 2018

[Javascript] The Fastest Conditionals

The three techniques presented here—the if statement, the switch statement, and array lookup—each have their uses in optimizing code execution:

Use the if statement when:

  • There are no more than two discrete values for which to test.
  • There are a large number of values that can be easily separated into ranges.


Use the switch statement when:

  • There are more than two but fewer than 10 discrete values for which to test.
  • There are no ranges for conditions because the values are nonlinear.


Use array lookup when:

  • There are more than 10 values for which to test.
  • The results of the conditions are single values rather than a number of actions to be taken.


Jan 26, 2018

Self-Reminder: Performance is Important

A study done by Amazon almost 10 years ago proved that, even then, a 100‑millisecond decrease in page‑loading time translated to a 1% increase in its revenue.

Another recent study highlighted the fact that that more than half of site owners surveyed said they lost revenue or customers due to poor application performance.

source: https://www.nginx.com/blog/10-tips-for-10x-application-performance/

Jun 24, 2017

CodeNote: Concurrently Add Index to a Table Without Downtime

You can use this migration code below if you forget to add index to your table and the data is big already.
This method will make you able to add index without lock any transaction in your table, but it also need more time and more CPU and I/O process.

class AddIndexToBuildMetricIdOnBuilds < ActiveRecord::Migration
  disable_ddl_transaction!
  def change
    add_index :table, :the_field, :algorithm => :concurrently
  end
end

Happy Code!

Oct 21, 2016

When client asking for estimation...

Plans are useless, but planning is indispensable.

Sep 27, 2016

Tips: Determine Priority

Important and urgent: Do it
Important and not urgent: Schedule it
Not important and urgent: Assign it
Not important nor urgent: Forget it