Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 19 18:56
    asterite ready_for_review #12405
  • Aug 19 18:56
    asterite edited #12405
  • Aug 19 17:43
    asterite labeled #12405
  • Aug 19 16:38
    Blacksmoke16 labeled #12405
  • Aug 19 16:38
    Blacksmoke16 labeled #12405
  • Aug 19 16:02
    asterite synchronize #12405
  • Aug 19 16:01
    asterite opened #12405
  • Aug 19 15:34
    kramerul synchronize #12404
  • Aug 19 15:23
    kramerul synchronize #12404
  • Aug 19 15:13
    kramerul synchronize #12404
  • Aug 19 15:10
    kramerul synchronize #12404
  • Aug 19 15:08
    Blacksmoke16 labeled #12404
  • Aug 19 15:08
    Blacksmoke16 labeled #12404
  • Aug 19 15:08
    Blacksmoke16 labeled #12404
  • Aug 19 15:06
    wonderix opened #12404
  • Aug 19 14:20
    asterite closed #12403
  • Aug 19 12:42
    straight-shoota milestoned #12403
  • Aug 19 12:42
    straight-shoota milestoned #12403
  • Aug 19 12:03
    asterite synchronize #12403
  • Aug 19 11:34
    straight-shoota closed #11420
marin117
@marin117
something like this
is there any better way than properties and referencing object
cevarief
@cevarief

can you try with /bin/ls ?

when using parameter, the output does not show. "ls -alh"

Serdar Dogruyol - Sedo セド
@sdogruyol
ugh
doesnt shards init app something creates a folder named something with shard.yml inside?
Ghost
@ghost~55586c4815522ed4b3e08557
@marin117 the class name must start with an uppercase lettre
Serdar Dogruyol - Sedo セド
@sdogruyol
so shards init and crystal init is different :/
that's confusing //cc @ysbaddaden
From IRC (bridge bot)
@FromIRC
<Groogy> marin117 classes must be constants and as such you can't write it in smaller case
<Groogy> it would have to be named A
<Groogy> also you would get an error because you are defining it differently between first and second definition
Ryan Breen
@rufusroflpunch
is there any actual reason to use the shards executable vs. just using the crystal commands?
From IRC (bridge bot)
@FromIRC
<Liosha> Sometimes, Crystal is just like C https://carc.in/#/r/2lw2 <⁠3 <⁠3 <⁠3
Bram Wyllie
@bitmappergit
is it possible to use a variable in quotes
From IRC (bridge bot)
@FromIRC
<Groogy> "#{a + b}"
unreadable
@unreadable
I did some benchmarking between playlyfe/go-graphql and crystal graphql
Serdar Dogruyol - Sedo セド
@sdogruyol
name = "Crystal"
"Hello #{name}"
unreadable
@unreadable
// Graphql-Cr
BenchmarkGraphQLGolang-8          200000              5986 ns/op
PASS
ok      _/home/alex/Projects/Crystal/graphql    1.273s


=====================================================
// Graphql-Go

graphql-cr  28.37k ( 35.25µs) (±52.60%) fastest

{
  "hello": "world"
}

Crystal -> 35.25µs               fastest
Go      -> 1273000µs        (x36113.47 slower)        
I thinkg I'm doing something wrong
Serdar Dogruyol - Sedo セド
@sdogruyol
@krypton97 that seems weird
unreadable
@unreadable
Well, time to try with the good old time substraction
From IRC (bridge bot)
@FromIRC
<Papierkorb> You're measuring total time of benchmarking tools. You should compare the per operation times as given by them instead
<Papierkorb> 5986ns/op doesn't sound so bad
unreadable
@unreadable
ok, here's the code that I used for each lang
require "graphql-crystal"
require "benchmark"

schema_definition = <<-graphql_schema
    schema {
        query: QueryType
    }

    type QueryType {
        hello: String
    }
graphql_schema

schema = GraphQL::Schema.from_schema(schema_definition)

schema.resolve do
    query "hello" { "world" }
end

Benchmark.ips do |x|
   x.report("graphql-cr") { schema.execute("{hello}") }
end

print "\n" + schema.execute("{ hello }")["data"].to_pretty_json
and for go
package graphql
import (
    "testing"
    "github.com/playlyfe/go-graphql"
)

var schema = `
    type QueryType {
        hello: String
    }
  `
var resolvers = map[string]interface{}{
    "QueryType/hello": func(params *graphql.ResolveParams) (interface{}, error) {
        return "world", nil
    },
}
var executor, _ = graphql.NewExecutor(schema, "QueryType", "", resolvers)

func BenchmarkGraphQLGolang(b *testing.B) {
    for i := 0; i < b.N; i++ {
        context := map[string]interface{}{}
        variables := map[string]interface{}{}
        executor.Execute(context, "{hello}", variables, "")
    }
}
either way, I like how light is the crystal version comparing to the go one
nvm, now I got 0.002s for golang version
From IRC (bridge bot)
@FromIRC
<Papierkorb> Yeah I know which lang I'd choose of those two if the only point of difference would be those exact two snippets
unreadable
@unreadable
well, the go version is used in production by the playlyfe guys, the crystal version is kinda new-ish
Bar Hofesh
@bararchy
Never used GO, WTH is this: {}{}
From IRC (bridge bot)
@FromIRC
<Papierkorb> Sure, however even if there are any showstopper bugs in the Crystal version, its API wouldn't change (much) by fixing them
<Papierkorb> @bararchy, my guess is interface{} is an anonymous interface type (in Go, that's "any type goes"), and the following {} could be anything, possibly an empty body for the anon interface we just defined (?)
Bar Hofesh
@bararchy
Also, what is := is it like ||= ?
From IRC (bridge bot)
@FromIRC
<Groogy> assignment
Bar Hofesh
@bararchy
Oh, so = became :=
...
From IRC (bridge bot)
@FromIRC
<Papierkorb> That syntax was also used by Pascal dialects, possibly others
<Groogy> yeah it is often used in faux code
<Papierkorb> At least then it was meant to hinder you from missing an equal sign in a condition
unreadable
@unreadable
map[string]interface{}{} means a map that takes string keys with interface{} value
:= seems better to me for assignment
Bar Hofesh
@bararchy
it does ? it's an extra char
unreadable
@unreadable
but there won't be confusion
and := is used for declaration and assignment
not only for assignment
From IRC (bridge bot)
@FromIRC
<Groogy> If your performance in coding stuff is affected by an extra char
<Groogy> then I donnu