This file contains 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
FG-386:rubinius acoyle$ ruby -Xjit.inline.debug repro.rb | |
JIT: compiling Array#include? (1440519539.55320) | |
| inline slot read: offset: 40 | |
| inline slot read: offset: 24 | |
| inlining: Fixnum#+ into include?. primitive fixnum_add (Fixnum) | |
| inline slot read: offset: 32 | |
| inlining: Fixnum#< into include?. primitive fixnum_compare_operation (Fixnum) | |
| inlining: Rubinius::Tuple#[] into include?. primitive tuple_at (Rubinius::Tuple) | |
| inlining: Kernel#equal? into include?. primitive object_equal (Symbol) | |
| inlining: String#== into include?. generic primitive: jit_stub_string_equal (String) |
This file contains 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
$str = "1-800-123-4567"; | |
print "$str\n"; | |
$str =~ s/[^0-9]//g; | |
print "$str\n"; |
This file contains 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
package benchtest | |
import ( | |
"encoding/json" | |
"fmt" | |
"strconv" | |
"testing" | |
"time" | |
) |
This file contains 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
package lolwut | |
import ( | |
"testing" | |
"github.com/stretchr/testify/assert" | |
) | |
func TestEqual(t *testing.T) { | |
assert.Equal(t, 1, nil) |
This file contains 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
STATE_MAP = { | |
outside_intial: 'Outside a bracket. Nothing Interesting', | |
outside_a: 'Outside a bracket. We found a character <a>', | |
outside_ab: 'Outside a bracket. After finding <a>, we found a <b> which was not the same as <a>', | |
outside_abb: 'Outside a bracket. After finding a sequence <a><b>, we found <b>', | |
solved_initial: 'Outside a bracket. We found a sequence <a><b><b><a>', | |
inside_intial: 'Inside a bracket. Nothing Interesting', | |
inside_a: 'Inside a bracket. We found a character <a>', | |
inside_ab: 'Inside a bracket. After finding <a>, we found a <b> which was not the same as <a>', | |
inside_abb: 'Inside a bracket. After finding a sequence <a><b>, we found <b>', |
This file contains 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
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"strings" | |
"time" | |
"github.com/dgrijalva/jwt-go" |
This file contains 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
[fg-386] escape > go test -bench=. -benchmem 2> /dev/null | |
goos: darwin | |
goarch: amd64 | |
BenchmarkA-8 2000000000 0.28 ns/op 0 B/op 0 allocs/op | |
BenchmarkAPrint-8 2000000 682 ns/op 8 B/op 1 allocs/op | |
BenchmarkEmptyPrint-8 2000000 611 ns/op 0 B/op 0 allocs/op | |
BenchmarkB-8 2000000000 0.27 ns/op 0 B/op 0 allocs/op | |
PASS | |
ok _/Users/acoyle/side/escape 5.117s |
This file contains 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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
var access func() int | |
func init() { |
This file contains 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
// pacakge iface is a comparison of two different interfaces for a client | |
// to a simple REST API. Assume I had access to both `GET /resource`, which | |
// returns a list of all resources (which may be empty), and `GET /resource/:id`, | |
// which returns the resource with the given ID, OR a 404 if no resource | |
// has that ID. Additionally, since these are http requests they could also | |
// fail with some other non-200 status code for a variety of reasons, and | |
// we want to be able to distinguish between a request that failed and a | |
// resource not existing. | |
// | |
// The issue I find is that using pointers is nicer in the case of getting a |
This file contains 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
package main | |
import ( | |
"errors" | |
"fmt" | |
"testing" | |
) | |
var err error |
OlderNewer