Skip to content

Instantly share code, notes, and snippets.

View razetime's full-sized avatar
⤵️
real

Raghu R razetime

⤵️
real
View GitHub Profile

Garbage Collection for Ractors

The fork of Ruby that I developed this project in can be found here: https://github.com/rm155/ruby/tree/Ractor-Local-GC-version-1

Background

Ruby 3.0 introduced Ractors, a feature that enables true concurrency in the language. By allowing different pieces of code to run at the same time, the execution time of program can be greatly reduced. However, when multiple processes work on the same data concurrently, it can lead to data race conditions, which cause the program to behave unpredictably. Because of this, Ruby heavily restricts the use of shared data between Ractors.

In my 2021 GSoC project, I helped modify existing Ruby libraries to be compliant with Ractor rules. The purpose of this was to make the functionality of those libraries usable within Ractors. After the project, I continued to work with Ractors, and I found that Ractors were not providing as much of a speedup as one might have expected. I a

∇ solvePart1 {
⍝ Construct a 2-column array with the first column being the command
⍝ and the second being the distance.
list ← ⊃ {(d n) ← ⍵ ⊂⍨ ⍵≠↑" " ◊ d (⍎n)}¨ io:read "/home/elias/prog/advent-of-code2021/part02.txt"
⍝ Convert each direction instruction into a vector (up, down or right)
directions ← { ⊃ ((0 1) (¯1 0) (1 0))[(⊂¨ "forward" "up" "down") ⍳ ⊂⍵] }¨ list[;0]
⍝ Multiply each direction with the distance and sum the results
⍝ and finally multiply the individual values
@danielcristofani
danielcristofani / life.b
Last active March 6, 2024 01:21
Game of Life program.
[life.b -- John Horton Conway's Game of Life
(c) 2021 Daniel B. Cristofani
http://brainfuck.org/]
>>>->+>+++++>(++++++++++)[[>>>+<<<-]>+++++>+>>+[<<+>>>>>+<<<-]<-]>>>>[
[>>>+>+<<<<-]+++>>+[<+>>>+>+<<<-]>>[>[[>>>+<<<-]<]<<++>+>>>>>>-]<-
]+++>+>[[-]<+<[>+++++++++++++++++<-]<+]>>[
[+++++++++brainfuck.org-------->>>]+[-<<<]>>>[>>,----------[>]<]<<[
<<<[
>--[<->>+>-<<-]<[[>>>]+>-[+>>+>-]+[<<<]<-]>++>[<+>-]
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active December 11, 2025 23:44
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@pckv
pckv / tag4solo.lua
Last active May 25, 2018 11:47
splits the given beatmap by combo, returns multiple txt files of hitobjects. requires Lua BitOP
--[[ LICENSE
The MIT License (MIT)
Copyright (c) 2016 PC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell