A really basic protobuf benchmark comparing the protobuf encoding/decoding performance.
For details please see the benchmark.rb
file in this gist and check the gpb benchmark files.
- protobuf-3.6.12
- gpb-3.26.6
defmodule LatencyBenchmark do | |
@default_settings %{ | |
num_actors: 1, | |
actions_per_actor: 1, | |
} | |
def benchmark(action_fn, settings) do # = num_actors, actions_per_actor, setup_fn, action_fn) do | |
settings = Map.merge(@default_settings, %{setup_fn: fn -> %{} end}) |> Map.merge(settings) | |
settings = Map.put(settings, :action_fn, action_fn) | |
{:ok, collector_pid} = Agent.start_link(fn -> [] end) |
A really basic protobuf benchmark comparing the protobuf encoding/decoding performance.
For details please see the benchmark.rb
file in this gist and check the gpb benchmark files.
quick_benchmark = fn(tcfn, tcn) -> | |
tc_l = :lists.seq(1,tcn) |> Enum.map(fn(_)-> tcfn |> :timer.tc |> elem(0) end) | |
tc_min = :lists.min(tc_l) | |
tc_max = :lists.max(tc_l) | |
tc_med = :lists.nth(round((tcn - 1) / 2), :lists.sort(tc_l)) | |
tc_avg = round(Enum.sum(tc_l) / tcn) | |
%{min: tc_min, max: tc_max, median: tc_med, average: tc_avg} | |
end | |
# quick_benchmark.(fn() -> do_some_work() end, 1000) will do 1000 iterations of work and report median, average, min and max back to you in microseconds |
I hereby claim:
To claim this, I am signing this object:
23:45:35.612 [debug] temperature update: {"/sys/bus/w1/devices/28-000007621b25/w1_slave", 21.625} | |
23:45:36.940 [debug] temperature update: {"/sys/bus/w1/devices/28-000007621b25/w1_slave", 21.625} | |
23:45:38.260 [debug] temperature update: {"/sys/bus/w1/devices/28-000007621b25/w1_slave", 21.625} | |
23:45:39.591 [debug] temperature update: {"/sys/bus/w1/devices/28-000007621b25/w1_slave", 21.687} | |
23:45:40.940 [debug] temperature update: {"/sys/bus/w1/devices/28-000007621b25/w1_slave", 21.687} |
var ColorConversion = require('helpers/ColorConversion'); | |
/** | |
Used for parsing all css rules on the document | |
object and replacing any default brand color | |
instances with the client's brand color scheme. | |
@class CssHelper | |
@example | |
```javascript |
require 'rrobots' | |
class MichaelRobotEntry | |
include Robot | |
INTERVAL = (3.14 * 2 * 100).to_i | |
def tick(events) | |
unless x < size && y < size | |
turn (135 - heading) |
First get the rrobots running locally on your machine by following the README on the repo.
Next make your own bot by making a file with the same name as the class that it defines (just like the examples/NervousDuck.rb
defines the NervousDuck
class).
Now put your bot into a gist and send a link to your gist to the person running the tournament.
module ActsAsCsv | |
def read | |
@csv_contents = [] | |
filename = self.class.to_s.downcase + '.csv' | |
file = File.new(filename) | |
@headers = file.gets.chomp.split(', ') | |
file.each do |row| | |
@csv_contents << row.chomp.split(', ') | |
end |
describe "my request" do | |
it "should update the model" do | |
Model.any_instance.should_receive(:save) do | |
self.changes.should include(:attribute) | |
self.attribute.should == 'value' | |
end | |
xhr :put, model_path(model), {attribute: 'value'} | |
end | |
end |