Skip to content

Instantly share code, notes, and snippets.

@csaunders
Created August 2, 2014 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csaunders/9007fba6ee68c39bf5eb to your computer and use it in GitHub Desktop.
Save csaunders/9007fba6ee68c39bf5eb to your computer and use it in GitHub Desktop.
Import Pipeline Performance
/Users/csaunders/development/ruby/steam-sauna [git::import_data *] [csaunders@OuterHaven] [13:41]
> bx rails c
Loading development environment (Rails 4.0.3)
irb(main):001:0> require 'benchmark'
=> false
irb(main):002:0> games = [201790, 251060, 227600]
=> [201790, 251060, 227600]
irb(main):003:0> pipeline = GameImportPipeline.new
=> #<GameImportPipeline:0x007ff8de129920>
irb(main):004:0> puts Benchmark.measure { pipeline.import(games) }
(1.1ms) SELECT "steam_games"."app_id", "steam_games"."updated_at" FROM "steam_games" WHERE "steam_games"."app_id" IN (201790, 251060, 227600)
SteamGame Load (1.1ms) SELECT "steam_games".* FROM "steam_games" WHERE "steam_games"."app_id" = 251060 ORDER BY "steam_games"."id" ASC LIMIT 1
(0.6ms) BEGIN
SQL (24.6ms) INSERT INTO "steam_games" ("app_id", "capsule_image", "categories", "created_at", "header_image", "multi_player", "title", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["app_id", 251060], ["capsule_image", "http://cdn.akamai.steamstatic.com/steam/apps/251060/capsule_231x87.jpg"], ["categories", "--- []\n"], ["created_at", Sat, 02 Aug 2014 13:42:32 UTC +00:00], ["header_image", "http://cdn.akamai.steamstatic.com/steam/apps/251060/header_292x136.jpg"], ["multi_player", true], ["title", "Wargame: Red Dragon"], ["updated_at", Sat, 02 Aug 2014 13:42:32 UTC +00:00]]
(2.0ms) COMMIT
(0.2ms) BEGIN
SQL (1.0ms) UPDATE "steam_games" SET "updated_at" = $1, "categories" = $2 WHERE "steam_games"."id" = 10 [["updated_at", Sat, 02 Aug 2014 13:42:32 UTC +00:00], ["categories", "--- []\n"]]
(0.5ms) COMMIT
SteamGame Load (0.7ms) SELECT "steam_games".* FROM "steam_games" WHERE "steam_games"."app_id" = 201790 ORDER BY "steam_games"."id" ASC LIMIT 1
(0.2ms) BEGIN
SQL (0.6ms) INSERT INTO "steam_games" ("app_id", "capsule_image", "categories", "created_at", "header_image", "multi_player", "title", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["app_id", 201790], ["capsule_image", "http://cdn.akamai.steamstatic.com/steam/apps/201790/capsule_231x87.jpg"], ["categories", "--- []\n"], ["created_at", Sat, 02 Aug 2014 13:42:32 UTC +00:00], ["header_image", "http://cdn.akamai.steamstatic.com/steam/apps/201790/header_292x136.jpg"], ["multi_player", false], ["title", "Orcs Must Die! 2"], ["updated_at", Sat, 02 Aug 2014 13:42:32 UTC +00:00]]
(0.4ms) COMMIT
(0.1ms) BEGIN
SQL (0.7ms) UPDATE "steam_games" SET "updated_at" = $1, "categories" = $2 WHERE "steam_games"."id" = 11 [["updated_at", Sat, 02 Aug 2014 13:42:32 UTC +00:00], ["categories", "--- []\n"]]
(0.4ms) COMMIT
SteamGame Load (0.7ms) SELECT "steam_games".* FROM "steam_games" WHERE "steam_games"."app_id" = 227600 ORDER BY "steam_games"."id" ASC LIMIT 1
(0.2ms) BEGIN
SQL (0.7ms) INSERT INTO "steam_games" ("app_id", "capsule_image", "categories", "created_at", "header_image", "multi_player", "title", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["app_id", 227600], ["capsule_image", "http://cdn.akamai.steamstatic.com/steam/apps/227600/capsule_231x87.jpg"], ["categories", "--- []\n"], ["created_at", Sat, 02 Aug 2014 13:42:32 UTC +00:00], ["header_image", "http://cdn.akamai.steamstatic.com/steam/apps/227600/header_292x136.jpg"], ["multi_player", false], ["title", "Castle of Illusion"], ["updated_at", Sat, 02 Aug 2014 13:42:32 UTC +00:00]]
(2.0ms) COMMIT
(0.2ms) BEGIN
SQL (0.8ms) UPDATE "steam_games" SET "updated_at" = $1, "categories" = $2 WHERE "steam_games"."id" = 12 [["updated_at", Sat, 02 Aug 2014 13:42:32 UTC +00:00], ["categories", "--- []\n"]]
(0.4ms) COMMIT
0.160000 0.010000 0.170000 ( 1.272756)
=> nil
irb(main):005:0>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment