This file contains hidden or 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
v1.4 |
This file contains hidden or 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 '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 |
This file contains hidden or 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 '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 |
This file contains hidden or 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
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 |
This file contains hidden or 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
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) |
This file contains hidden or 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 'digest/sha2' | |
# GC.disable | |
N = 1_500_000 | |
#N = 500_000 | |
def workload | |
sha2 = Digest::SHA2.new | |
N.times do |
This file contains hidden or 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 'openssl' | |
require 'base64' | |
$VERBOSE = nil | |
#GC.disable | |
# N = 1_500_000 | |
N = 100 | |
class BaseEncryption | |
This file contains hidden or 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
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] |
This file contains hidden or 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 '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| |
This file contains hidden or 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
# ц | |
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__) |
OlderNewer