This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWS_SIG4_SIGNER = Aws::Sigv4::Signer.new( | |
service: 's3', | |
region: AWS_CLIENT.config.region, | |
credentials_provider: SOME_AWS_CLIENT.config.credentials, | |
unsigned_headers: Aws::S3::Presigner::BLACKLISTED_HEADERS, | |
uri_escape_path: false | |
) | |
def naive_with_uri_escape_escaping(shrine_file) | |
# because URI.escape does NOT escape `/`, we don't need to split it, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
original AWS SDK public_url implementation 0.053043 0.000275 0.053318 ( 0.053782) | |
naive implementation 0.004730 0.000016 0.004746 ( 0.004760) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def naive_public_url(shrine_file) | |
"https://#{["#{shrine_file.storage.bucket.name}.s3.amazonaws.com", *shrine_file.storage.prefix, shrine_file.id].join('/')}" | |
end | |
naive_public_url(model.image) | |
#=> "https://somebucket.s3.amazonaws.com/path/to/image.jpg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def naive_public_url(shrine_file) | |
"https://#{["#{shrine_file.storage.bucket.name}.s3.amazonaws.com", *shrine_file.storage.prefix, shrine_file.id].join('/')}" | |
end | |
naive_public_url(model.image) | |
#=> "https://somebucket.s3.amazonaws.com/path/to/image.jpg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user system total real | |
sdk public_url 0.054114 0.000335 0.054449 ( 0.054802) | |
naive S3 public url 0.004575 0.000009 0.004584 ( 0.004582) | |
naive S3 public url with URI.escape 0.009892 0.000090 0.009982 ( 0.011209) | |
sdk presigned_url 0.756642 0.005855 0.762497 ( 0.789622) | |
re-use instantiated SDK Presigner 0.817595 0.005955 0.823550 ( 0.859270) | |
use inline instantiated Aws::Sigv4::Signer directly for presigned url (with escaping) 0.216338 0.001941 0.218279 ( 0.226991) | |
Re-use Aws::Sigv4::Signer for presigned url (with escaping) 0.185855 0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A local domain ActiveRecord, Asset#file is a shrine attachment | |
asset = Asset.last | |
# load outside of benchmarking | |
asset.file | |
s3_object = asset.file.storage.object(asset.file.id) | |
ITERATIONS = (ENV['ITERATIONS'] || "1200").to_i | |
$stderr.puts "#{ITERATIONS} iterations\n\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A local domain ActiveRecord, Asset#file is a shrine attachment | |
asset = Asset.last | |
asset.file # load outside of benchmarking | |
s3_object = asset.file.storage.object(asset.file.id) # Aws::S3::Object | |
require 'erb' | |
require 'escape_utils' | |
def naive_public_url(shrine_file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expected Lu category: 1415 | |
Lt (31) | |
Dž,Lj,Nj,Dz,ᾈ,ᾉ,ᾊ,ᾋ,ᾌ,ᾍ,ᾎ,ᾏ,ᾘ,ᾙ,ᾚ,ᾛ,ᾜ,ᾝ,ᾞ,ᾟ,ᾨ,ᾩ,ᾪ,ᾫ,ᾬ,ᾭ,ᾮ,ᾯ,ᾼ,ῌ,ῼ | |
no_categories_found (105) | |
Ϳ,Ԩ,Ԫ,Ԭ,Ԯ,Ᏽ,Ꚙ,Ꚛ,Ꞗ,Ꞙ,Ꞛ,Ꞝ,Ꞟ,Ɜ,Ɡ,Ɬ,Ʞ,Ʇ,Ʝ,Ꭓ,Ꞵ,Ꞷ,𐲀,𐲁,𐲂,𐲃,𐲄,𐲅,𐲆,𐲇,𐲈,𐲉,𐲊,𐲋,𐲌,𐲍,𐲎,𐲏,𐲐,𐲑,𐲒,𐲓,𐲔,𐲕,𐲖,𐲗,𐲘,𐲙,𐲚,𐲛,𐲜,𐲝,𐲞,𐲟,𐲠,𐲡,𐲢,𐲣,𐲤,𐲥,𐲦,𐲧,𐲨,𐲩,𐲪,𐲫,𐲬,𐲭,𐲮,𐲯,𐲰,𐲱,𐲲,𑢠,𑢡,𑢢,𑢣,𑢤,𑢥,𑢦,𑢧,𑢨,𑢩,𑢪,𑢫,𑢬,𑢭,𑢮,𑢯,𑢰,𑢱,𑢲,𑢳,𑢴,𑢵,𑢶,𑢷,𑢸,𑢹,𑢺,𑢻,𑢼,𑢽,𑢾,𑢿 | |
Lo (85) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'twitter_cldr' | |
chars = "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸŹŻŽƁƂƄƆƇƉƊƋƎƏƐƑƓƔƖƗƘƜƝƟƠƢƤƦƧƩƬƮƯƱƲƳƵƷƸƼDŽDžLJLjNJNjǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZDzǴǶǷǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺȻȽȾɁɃɄɅɆɈɊɌɎͰͲͶͿΆΈΉΊΌΎΏΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫϏϒϓϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹϺϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԨԪԬԮԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉՊՋՌՍՎՏՐՑՒՓՔՕՖႠႡႢႣႤႥႦႧႨႩႪႫႬႭႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅჇჍᎠᎡᎢᎣᎤᎥᎦᎧᎨᎩᎪᎫᎬᎭᎮᎯᎰᎱᎲᎳᎴᎵᎶᎷᎸᎹᎺᎻᎼᎽᎾᎿᏀᏁᏂᏃᏄᏅᏆᏇᏈᏉᏊᏋᏌᏍᏎᏏᏐᏑᏒᏓᏔᏕᏖᏗᏘᏙᏚᏛᏜᏝᏞᏟᏠᏡᏢᏣᏤᏥᏦᏧᏨᏩᏪᏫᏬᏭᏮᏯᏰᏱᏲᏳᏴᏵḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈἉἊἋἌἍἎἏἘἙἚἛἜἝἨἩἪἫἬἭἮἯἸἹἺἻἼἽἾἿὈὉὊὋὌὍὙὛὝὟὨὩὪὫὬὭὮὯᾈᾉᾊᾋᾌᾍᾎᾏᾘᾙᾚᾛᾜᾝᾞᾟᾨᾩᾪᾫᾬᾭᾮᾯᾸᾹᾺΆᾼῈΈῊΉῌῘῙῚΊῨῩῪΎῬῸΌῺΏῼℂℇℋℌℍℐℑℒℕℙℚℛℜℝℤΩℨKÅℬℭℰℱℲℳℾℿⅅⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅬⅭⅮⅯↃⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏⰀⰁⰂⰃⰄⰅⰆⰇⰈⰉⰊⰋⰌⰍⰎⰏⰐⰑⰒⰓⰔⰕⰖⰗⰘⰙⰚⰛⰜⰝⰞⰟⰠⰡⰢⰣⰤⰥⰦⰧⰨⰩⰪⰫⰬⰭⰮⱠⱢⱣⱤⱧⱩⱫⱭⱮⱯⱰⱲⱵⱾⱿⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RuntimeError: Cannot load `Rails.application.database_configuration`: | |
Could not load database configuration. No such file - ["config/database.yml"] | |
/Users/jrochkind/.gem/ruby/2.4.2/gems/railties-5.2.0/lib/rails/application/configuration.rb:185:in `database_configuration' | |
/Users/jrochkind/.gem/ruby/2.4.2/gems/activerecord-5.2.0/lib/active_record/railtie.rb:133:in `block (2 levels) in <class:Railtie>' | |
/Users/jrochkind/.gem/ruby/2.4.2/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval' | |
/Users/jrochkind/.gem/ruby/2.4.2/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook' | |
/Users/jrochkind/.gem/ruby/2.4.2/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control' | |
/Users/jrochkind/.gem/ruby/2.4.2/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook' | |
/Users/jrochkind/.gem/ruby/2.4.2/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:52:in `block in run_loa |
NewerOlder