rspec tweaks

Download Rspec Tweaks

Post on 17-Feb-2017

330 views

Category:

Technology

0 download

Embed Size (px)

TRANSCRIPT

  • Rspec TweaksOmbu Labs, January 2016

  • Fixture Insert (0.3ms) INSERT INTO `account_types` (`name`, `country_id`, `monthly_cost`, `currency`, `created_at`, `updated_at`, `id`) VALUES ('Plus', 130, 50, 'MXN', '2016-01-18 13:24:08', '2016-01-18 13:24:08', 187940547) Fixture Insert (0.3ms) INSERT INTO `account_types` (`name`, `country_id`, `monthly_cost`, `currency`, `created_at`, `updated_at`, `id`) VALUES ('Base', 130, 30, 'MXN', '2016-01-18 13:24:08', '2016-01-18 13:24:08', 1010077272) Fixture Insert (0.3ms) INSERT INTO `account_types` (`name`, `country_id`, `monthly_cost`, `currency`, `created_at`, `updated_at`, `id`) VALUES ('Premium', 130, 10, 'MXN', '2016-01-18 13:24:08', '2016-01-18 13:24:08', 624812012) Fixture Insert (0.2ms) INSERT INTO `account_types` (`name`, `country_id`, `monthly_cost`, `currency`, `created_at`, `updated_at`, `id`) VALUES ('Plus', 40, 25000, 'CLP', '2016-01-18 13:24:08', '2016-01-18 13:24:08', 305852283) Fixture Insert (0.2ms) INSERT INTO `account_types` (`name`, `country_id`, `monthly_cost`, `currency`, `created_at`, `updated_at`, `id`) VALUES ('Base', 40, 10000, 'CLP', '2016-01-18 13:24:08', '2016-01-18 13:24:08', 42332910) Fixture Insert (0.3ms) INSERT INTO `account_types` (`name`, `country_id`, `monthly_cost`, `currency`, `created_at`, `updated_at`, `id`) VALUES ('Premium', 40, 13000, 'CLP', '2016-01-18 13:24:08', '2016-01-18 13:24:08', 897761919) Fixture Insert (0.2ms) INSERT INTO `account_types` (`name`, `country_id`, `monthly_cost`, `currency`, `created_at`, `updated_at`, `id`) VALUES ('Designer', 9, 0, 'ARS', '2016-01-18 13:24:08', '2016-01-18 13:24:08', 302242410) Fixture Insert (0.2ms) INSERT INTO `account_types` (`name`, `country_id`, `monthly_cost`, `currency`, `created_at`, `updated_at`, `id`) VALUES ('Plus', 214, 25000, 'USD', '2016-01-18 13:24:08', '2016-01-18 13:24:08', 621079293) Fixture Insert (0.2ms) INSERT INTO `account_types` (`name`, `country_id`, `monthly_cost`, `currency`, `created_at`,68, 250) Fixture Insert (0.2ms) INSERT INTO `countries` (`name`, `iso3`, `iso`, `iso_name`, `id`, `numcode`) VALUES ('Iran, Islamic Republic of', 'IRN', 'IR', 'IRAN, ISLAMIC REPUBLIC OF', 94, 364) Fixture Insert (0.2ms) INSERT INTO `countries` (`name`, `iso3`, `iso`, `iso_name`, `id`, `numcode`) VALUES ('Niue', 'NIU', 'NU', 'NIUE', 149, 570) Fixture Insert (0.2ms) INSERT INTO `countries` (`name`, `iso3`, `iso`, `iso_name`, `id`, `numcode`) VALUES ('Samoa',

    332 Inserts

    for a simple Controller Spec

    with one User

  • let vs instance variables

  • After some refactoring

  • use more let

  • just build, dont create!

  • flexible use of let

  • more than 65% faster!!!

  • but still 0.54243 seconds without AR?!

  • The logs tell me this:

    which means something is creating this record o.O

    Okeeeey -_-

  • Tests without AR references:

    Still slow, but this is due to the file operations of our validation.

    78% faster! O_O

  • Thank you!Questions?