Skip to content

Instantly share code, notes, and snippets.

View nasospsa's full-sized avatar

Nasos Psarrakos nasospsa

View GitHub Profile
@nasospsa
nasospsa / gist:4612417
Last active December 11, 2015 14:09
Calculate the value based on percent
var randomValues= [33, 56, 29, 67, 96, 58, 72, 88, 92, 61, 19, 100, 47, 96, 93, 16, 68, 9, 6, 41, 9, 95, 69, 89, 68, 22, 52, 28, 48, 76, 80, 35, 29, 18, 60, 95, 5, 46, 98, 55, 94, 70, 36, 94, 97, 38, 23, 98, 58, 61, 93, 55, 30, 86, 92, 74, 64, 48, 70, 69, 27, 2, 76, 52, 27, 100, 1, 23, 86, 3, 66, 63, 59, 35, 77, 75, 93, 76, 58, 32, 15, 51, 17, 67, 99, 83, 79, 67, 76, 71, 3, 31, 79, 25, 5, 66, 14, 7, 96, 48, 65, 93, 67, 9, 52, 92, 24, 73, 47, 78, 21, 48, 26, 58, 34, 55, 12, 25, 3, 62, 60, 40, 67, 73, 100, 94, 89, 96, 35, 85, 29, 13, 61, 83, 52, 75, 30, 83, 90, 60, 67, 21, 2, 54, 52, 48, 45, 26, 80, 100, 30, 6, 85, 81, 13, 84, 22, 14, 16, 98, 7, 34, 99, 86, 57, 10, 17, 98, 59, 33, 17, 4, 80, 93, 73, 92, 12, 17, 94, 1, 97, 37, 67, 35, 15, 13, 13, 82, 21, 5, 92, 52, 46, 57, 55, 34, 98, 47, 30, 93, 11, 34, 68, 28, 89, 73, 34, 79, 96, 7, 50, 98, 44, 4, 15, 89, 39, 47, 89, 86, 8, 34, 33, 19, 57, 73, 22, 70, 92, 72, 26, 21, 88, 53, 33, 29, 48, 1, 7, 75, 50, 99, 70, 86, 40, 57, 71, 21, 55, 89, 89, 3, 36, 67, 30, 44, 2
@nasospsa
nasospsa / bench_rails_script_memory_usage.rb
Last active February 21, 2017 17:02
Rails script benchmarking
def start_script
puts "starting script..."
# Remove the X to enable the parameters for tuning.
# These are the default values as of Ruby 2.2.0.
@child = spawn(<<-EOC.split.join(" "))
XRUBY_GC_HEAP_FREE_SLOTS=4096
XRUBY_GC_HEAP_INIT_SLOTS=10000
XRUBY_GC_HEAP_GROWTH_FACTOR=1.8
XRUBY_GC_HEAP_GROWTH_MAX_SLOTS=0
XRUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=2.0