Skip to content

Instantly share code, notes, and snippets.

View Inversion-des's full-sized avatar
:octocat:
Developing

Yuriy Babak Inversion-des

:octocat:
Developing
View GitHub Profile
# ц
puts `chcp`
p Encoding.default_external
p file:__FILE__
p dir:__dir__
puts '-'*10
p LOAD_PATH:$LOAD_PATH[0]
p start_with:$LOAD_PATH[0].start_with?(__dir__)
require 'openssl'
require 'base64'
# calibrate numbers to get 1s or 10s in solo
N = 48
DATA_SIZE = 600_000
workers_N = 2
# prepare static data set
DATA_ARR = N.times.map do |n|
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x64-mingw32]
in the main thread
Total: 2.092
in 2 ractors
[=[<OBJ_INFO:gc_mark_ptr@../ruby-3.0.0/gc.c:6106> 0x00000000062f6920 [0 M ] T_NONE
sha_test_big_data.rb:31: [BUG] try to mark T_NONE object
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x64-mingw32]
require 'openssl'
require 'base64'
$VERBOSE = nil
#GC.disable
# N = 1_500_000
N = 100
class BaseEncryption
require 'digest/sha2'
# GC.disable
N = 1_500_000
#N = 500_000
def workload
sha2 = Digest::SHA2.new
N.times do
@Inversion-des
Inversion-des / gist:40fa039a13f9f5ccd5b5f96c62bcfb54
Created June 12, 2019 19:25
Pry session performance impact results on Windows
1.1) Normal
insert 500 (w:0) -- total: 0.207 s, item time = 0.413 ms ( 1.00x) (0.00)
insert 500 (w:1) -- total: 3.786 s, item time = 7.571 ms ( 1.00x) (0.00)
500 times find all -- total: 14.368 s, item time = 28.735 ms ( 1.00x) (0.00)
500 times find first (full) -- total: 5.316 s, item time = 10.632 ms ( 1.00x) (0.00)
500 times find first (full by id) -- total: 4.185 s, item time = 8.370 ms ( 1.00x) (0.00)
500 times find first (only name) -- total: 4.954 s, item time = 9.907 ms ( 1.00x) (0.00)
500 times count() -- total: 2.740 s, item time = 5.479 ms ( 1.00x) (0.00)
single find first (full) (0) -- total: 0.004 s, item time = 4.160 ms ( 1.00x) (0.00)
single find first (full) (1) -- total: 0.014 s, item time = 13.738 ms ( 1.00x) (0.00)
@Inversion-des
Inversion-des / win_pry_case.rb
Created June 12, 2019 19:23
Pry session performance impact test
puts 'start'
require 'mongo'
Mongo::Logger.level = Logger::FATAL
$client = Mongo::Client.new('mongodb://127.0.0.1:15000/test', :connect => :direct, min_pool_size:1)
@item_tyme_by_title = {}
def watch(title:)
ttime = nil
_time_start = Time.now
@Inversion-des
Inversion-des / for_new.rb
Created June 11, 2019 20:32
tests for mongo
require 'mongo'
Mongo::Logger.level = Logger::FATAL
client = Mongo::Client.new('mongodb://127.0.0.1:27364/test')
#client = Mongo::Client.new('mongodb://%2Ftmp%2Fmongodb-27364.sock/test')
collection = client[:people]
collection.delete_many
@Inversion-des
Inversion-des / Decorators.rb
Created July 27, 2018 09:05
Ruby Memoizable decorator experiment (from power-of-trust.net)
require 'concurrent'
require 'method_decorators'
# usage in class:
# include Decorators
module Decorators
# when module included (hook)
def self.included(base)
# some class-methods needed for decorators to work
base.extend MethodDecorators
@Inversion-des
Inversion-des / test
Last active December 1, 2015 19:36
My description2
v1.4