<RX14>
Papierkorb, i meant 10 fibers, each which block on accept
<Papierkorb>
Wouldn't make a difference for few long-living connections
soveran has quit [Remote host closed the connection]
<Papierkorb>
Mh got it to 90k pings/second through a single connection. though now incoming requests are handeled fully synchronously :|
<Papierkorb>
that is, an expensive call now blocks the connection on the server and thus for the client too
<Papierkorb>
Surprisingly, the inner fiber/channel combo which reads the argument data, spawns and runs the actual method inside is much less expensive than the outer fiber which unblocks the connection
<Papierkorb>
the outer one costs 8-10k, the inner ~5k
<RX14>
I removed a lookup table and replaced it with a case statement with loads of branches
<RX14>
and it made is faster
<RX14>
damnit llvm
<RX14>
i dumped the asm and it turns out it does some complex stuff using greater than to take some fast paths
danielpclark has quit [Remote host closed the connection]
sz0 has quit [Quit: Connection closed for inactivity]
skinkitten has joined #crystal-lang
skinkitten_ has joined #crystal-lang
<crystal-gh>
[crystal] dylandrop opened pull request #4033: Hash should not default to 11 if it is specified (master...hash-should-not-default-to-11) https://git.io/vD6Ep
mgarciaisaia has joined #crystal-lang
mgarciaisaia has quit [Ping timeout: 264 seconds]
<crystal-gh>
[crystal] dylandrop opened pull request #4034: User-Agent should be properly capitalized in exec (master...user-agent-should-be-properly-capitalized) https://git.io/vD6zW
squeaky_ has joined #crystal-lang
skinkitten has quit [Ping timeout: 240 seconds]
skinkitten_ has quit [Ping timeout: 240 seconds]
Philpax has quit [Ping timeout: 240 seconds]
Philpax has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
stnly has quit [Quit: Reconnecting]
stnly has joined #crystal-lang
stnly has quit [Client Quit]
stnly has joined #crystal-lang
soveran has joined #crystal-lang
bjz has joined #crystal-lang
<FromGitter>
<sdogruyol> nice one @Papierkorb
<FromGitter>
<F1ks3r> hey guys, new to crystal, can it be used to build desktop apps?
<FromGitter>
<sdogruyol> @F1ks3r they are some libraries that you can use
CompanionCube has quit [Ping timeout: 240 seconds]
CompanionCube has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
bjz has joined #crystal-lang
bjz_ has quit [Ping timeout: 240 seconds]
Ven has joined #crystal-lang
snsei has joined #crystal-lang
soveran has quit [Remote host closed the connection]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
Rinkana has joined #crystal-lang
bjz_ has joined #crystal-lang
<Rinkana>
Is there a way where i can define within a class that it uses classes from another module so that i don't need to namespace it. Just like the C# `using`. Example: https://play.crystal-lang.org/#/r/1n08
bjz has quit [Ping timeout: 258 seconds]
<RX14>
in general I think the answer is just to type it out, and to avoid excsessively long modules
<RX14>
In ruby you can shortcut it by doing Foo = FooModule::Foo somewhere
<RX14>
but I don't think you can do that in crystal
<RX14>
oh wait
<RX14>
you can use Alias
<RX14>
alias seems to not be exactly the same sometimes though
<RX14>
also doesn't work with generics
<RX14>
so it's an incomplete solution
<Rinkana>
Hmm, alright then. I just tought it might be easier as i already know what module it is in
<Rinkana>
Thanks anyway!
<RX14>
alias works in that situation
snsei has quit [Remote host closed the connection]
<RX14>
alias Foo = FooModule::Foo in BarModule works
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
<Rinkana>
Ah yes, that can work for now.
squeaky_ has joined #crystal-lang
<Rinkana>
However in this case i might still want to use the full name. As there can be quite a few classes in one module. And a list of aliases in the other classes can be unmanageable
snsei has joined #crystal-lang
<Rinkana>
I might make a macro for that.
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
snsei has quit [Remote host closed the connection]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: https://git.io/vDiZ3
<FromGitter>
<crisward> Our company website, and the cms system it runs on is now powered by crystal. It's a draft implementation, which I hope we can move our clients to once complete. https://www.duodesign.co.uk
<Qchmqs>
I'm no C code (can do C, but I'm so unwilling it's beyond english to express)
<RX14>
it's not got much use on shared hosting I think because i don't think that the libraries crystal required would be generally installed on shard hosting
<RX14>
you'd have to work around it with some weird half-static half-dynamic linking
<Qchmqs>
that was the plan
<Qchmqs>
but the more I think about it, the more I think it stinks
<RX14>
well the plan would be to read the CGI and convert it into a HTTP::Request
<Qchmqs>
I suppose a superior alternative would be heroku/aws/appspot builds
<RX14>
and then take a HTTP::Server::Response and do that
<RX14>
there's a hroku buildpack iirc
<RX14>
never used it myself but heroku should work
<akwiatkowski>
shameless selfpromotion - I've updated readme, added repeated (monthly, yearly, ...) events/todos to cli organizer/calendar in crystal https://github.com/akwiatkowski/ocranizer . It creates clean html (all styles in it) and open in default browser.
<RX14>
would be nice if you could loose the {} line you can with NamedTuple however
<Papierkorb>
class Foo(*T) ?
<RX14>
double variadic
<RX14>
like namedtuple
<RX14>
not tuple
<Papierkorb>
oh
lhz has joined #crystal-lang
<RX14>
i'm trying to allow this in my HTTP framework controllers:
<RX14>
include Framework::Controller(db: DB::Database, redis: Redis)
<RX14>
then you can pass in the db and redis as args
skinkitten has joined #crystal-lang
skinkitten_ has joined #crystal-lang
<Papierkorb>
Yay my digest revamp doesn't break any specs (Except for the module and method renames of course)
<RX14>
oh, you're working on that?
<RX14>
that's great
<Papierkorb>
A bit nervous what people will think of it. I DRY'd it up a bit.
<RX14>
well
<RX14>
we'll see
<RX14>
things can get a bit past DRY and into unreadable
skinkitten has quit [Ping timeout: 260 seconds]
skinkitten_ has quit [Ping timeout: 240 seconds]
<Papierkorb>
Squashed commit or multiple commits?
<RX14>
pretty coarse-grain commits In my opinion
<RX14>
but still keep seperate things seperate
<RX14>
for example my multipart PR had 1 commit for each logical addition or upgrade to http/common, and then one for each of multipart and formdata
<FromGitter>
<fridgerator> what is the `Char` representation of `"\x00"` in ruby?
<Papierkorb>
Ruby uses a string instead
<Papierkorb>
So, exactly what you wrote should work
<RX14>
I just managed to get a load of macro magic to work first time
<RX14>
without the compiler complaining at me
<RX14>
I feel like I deserve an award
<FromGitter>
<fridgerator> I'm trying to parse a CSV that has no quote char, in ruby I could just use that as the quote char, trying to find the equivalent
<FromGitter>
<fridgerator> CSV only accepts a char as parameter for the quote char
<RX14>
oh
<RX14>
you want in crystal
<RX14>
you use '\0'
<RX14>
that's a char representing the null byte
<FromGitter>
<fridgerator> kk, ty
<FromGitter>
<fridgerator> my original question was worded weird
<RX14>
the Context/ContextImpl split seems pointless
<Papierkorb>
The Context is a class, the Impl a struct, avoids a memory allocation .. was the intention of the person who initially came up with it I guess
<Papierkorb>
Context is basically a delegating Pointer(ContextImpl), yes
<Papierkorb>
Better worded: Context is basically a class wrapper around the Impl struct
<RX14>
yeah I think i'd just remove that
<Papierkorb>
then ContextImpl would have to become a class
<RX14>
and make it Digest::Base(Context)
<RX14>
there needs to be a class allocation anyway
<RX14>
so it doesn't matter does it
<RX14>
you're not gaining any perf
<RX14>
you're just moving it outside
<Papierkorb>
No it doesn't, the class allocation is only needed for the yielding version
<Papierkorb>
the non-yielding versions don't need it
<RX14>
thats just annoying
<Papierkorb>
it's an artifact of crystal not having something like a c++ reference. I'd be fine with getting rid of it, I just want to point out potentional performance regressions
<Papierkorb>
RX14: what's "thats annonying" referring to? the need for memory allocation? the wrapper class?
<RX14>
the wrapper class
<RX14>
the fact that it's required
<Papierkorb>
oh I think we're on the same page there
<RX14>
there should just be a Reference(T)
<RX14>
and you just yield Reference(Context).new
<RX14>
and it uses method_missing to delegate
<Papierkorb>
... is that possible?
<RX14>
...yes
<RX14>
why would it not?
Renich has joined #crystal-lang
<RX14>
well
<Papierkorb>
I always thought Reference was magic
<RX14>
well no
<RX14>
it wouldn't be called Reference
<RX14>
because thats already in use
<Papierkorb>
ah
<RX14>
it would be a new class
<Papierkorb>
Yeah I built that some time ago, and called it .. Ref
<RX14>
Reference is magic
<RX14>
ye
<Papierkorb>
cause Reference is taken >_>
<RX14>
why not PR what you've got
<RX14>
explain the need for Ref(T)
<Papierkorb>
Would rename it to StructReference(T) though, maybe that name's better
<Papierkorb>
Though that I'd want to put into its own PR, if that gets merged before the digest one or if there needs to be a follow-up PR for the digest cleanup² - I'm fine with both
<RX14>
well as I said
<RX14>
i'd introduce it in the PR comments
<RX14>
so it's got a clear usecase
<Papierkorb>
Is `Ref(T)` fine? It's a bit .. err .. short
<Yxhuvud>
well, you can have Digest::Reference or whatever if you wish. that should work (but perhaps be confusing)
<Papierkorb>
Yxhuvud: I'd put the reference wrapper into src/, I'd wager I'm not the first or last one who needs that. Or is it too "excotic" of a feature?
<Yxhuvud>
ah it is not supposed to be part of somehting else. then it is indeed taken.
Renich has quit [Quit: leaving]
Renich has joined #crystal-lang
<Yxhuvud>
but isn't it basically a Delegator? That it wraps a struct seems to be more or less irrelevant to the actual use.
<Papierkorb>
it's a delegator, it's just that it's allocated on the heap
<Papierkorb>
Or did you mean the Ref(T) thing?
<Yxhuvud>
Hmm. I may have been confused, as usual.
<RX14>
you can use Ref(T) without a struct
<RX14>
but it won't make sense
<Papierkorb>
yes#
<RX14>
it'll just be a waste
<RX14>
Papierkorb, you know we have WeakRef
<RX14>
(T)
<RX14>
so i'd call it Ref(T)
<RX14>
so be analogous
<RX14>
although I guess they're very different
<Papierkorb>
I think it'd cause confusion
<RX14>
what if you unified them
<Papierkorb>
People open the docs, ctrl+f Ref and then have no idea what that thing's about
<RX14>
so they're basically exactly the same thing
<RX14>
actually no that's dumb
<RX14>
because Ref(T)'s target is always there
<RX14>
WakRef(T)'s target is not
<Papierkorb>
StructRef(T) as compromise?
<Papierkorb>
Or ValueRef(T)?
<Papierkorb>
I mean it's actually a Value reference..
<RX14>
yeah
<RX14>
ValueRef
<Papierkorb>
RX14: w.r.t. http requests/second, are you using DDR3 memory?
<RX14>
yup
<RX14>
i5-3570K
<RX14>
16gb of ddr3
<RX14>
1600mhz
<RX14>
9-9-9-24
<RX14>
i feel like I shouldn't be able to reall my ram timings off the top of my head but whatever
soveran has quit [Remote host closed the connection]
<FromGitter>
<sdogruyol> @spalladino thank you :+1:
<FromGitter>
<spalladino> ;)
<FromGitter>
<sdogruyol> it's great to see a site built with Kemal and Crystal :smile:
<FromGitter>
<sdogruyol> it's blazing fast :fast_forward:
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
akwiatkowski has joined #crystal-lang
bjz has joined #crystal-lang
<RX14>
anyone know what the point of nillable: true is in DB.mapping/JSON.mapping when you can just use Foo? instead of {type: Foo, nillable: true}
<crystal-gh>
[crystal] felipeelias opened pull request #4038: OAuth2::Client sends Accept headers by default (master...oauth2_accept_header) https://git.io/vDPy2
<Papierkorb>
oh great, I fabricated a style issue
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter>
<drosehn> Isn't it that "nillable" is setting an option for the variable? `nillable: true` means `Foo | Nil`, while `nillable: false` means it is just plain`Foo`.
<FromGitter>
<drosehn> ... if I remember correctly.
<BlaXpirit>
drosehn, the point is that `Foo?` seemingly has the same effect as `nilable: true`, then why even have this verbose syntax
<FromGitter>
<Sija> @RX14 IIRC `nilable` option predates `?` modifier, also it allows to pass it as a custom variable without connection to the type