Generating a musical scale programmatically
A Pen by Stéphane Busso on CodePen.
Generating a musical scale programmatically
A Pen by Stéphane Busso on CodePen.
<article> | |
<aside id="aside"></aside> | |
<main id="main"></main> | |
</article> |
require "active_record" | |
namespace :db do | |
db_config = YAML::load(File.open('config/database.yml')) | |
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'}) | |
desc "Create the database" | |
task :create do | |
ActiveRecord::Base.establish_connection(db_config_admin) |
I am passionate about Ruby, but its execution time compared to other languages is extremely high, especially when we want to use more complex algorithms. In general, data structures in interpreted languages become incredibly slow compared to compiled languages. Some algorithms such as ´n-body´ and ´fannkuch-redux´ can be up to 30 times slower in Ruby than Go. This is one of the reasons I was interested in embedding Go code in a Ruby environment.
For those who do not know how shared libraries operate, they work in a similar way as DLLs in Windows. However, they have a native code with a direct interface to the C compiler.
Note Windows uses the DLL system, and in this case, this does not necessarily have to be in native code.
One example is DLLs written in C#, which runs on a virtual machine. Because I do not use windows, I ended up not testing if it is poss
# SCS | |
BenchmarkSCSMemstore-8 200000 9573 ns/op 3643 B/op 49 allocs/op | |
BenchmarkSCSCookies-8 100000 23220 ns/op 7516 B/op 83 allocs/op | |
BenchmarkSCSRedis-8 30000 45783 ns/op 4459 B/op 76 allocs/op | |
BenchmarkSCSMySQL-8 300 5782698 ns/op 4382 B/op 73 allocs/op | |
BenchmarkSCSPostgres-8 500 3715685 ns/op 5585 B/op 96 allocs/op | |
# Gorilla |
<template> | |
<div></div> | |
</template> | |
<script> | |
import Trix from 'trix'; | |
export default { | |
props: ['value'], |
package main | |
import ( | |
"bufio" | |
"fmt" | |
"os" | |
"time" | |
) | |
const numWorkers = 3 |
package main | |
import ( | |
"context" | |
"flag" | |
"fmt" | |
"io" | |
"net" | |
"net/http" | |
"os" |
// Package main is a sample macOS-app-bundling program to demonstrate how to | |
// automate the process described in this tutorial: | |
// | |
// https://medium.com/@mattholt/packaging-a-go-application-for-macos-f7084b00f6b5 | |
// | |
// Bundling the .app is the first thing it does, and creating the DMG is the | |
// second. Making the DMG is optional, and is only done if you provide | |
// the template DMG file, which you have to create beforehand. | |
// | |
// Example use: |