Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 18:26
    beta-ziliani milestoned #13043
  • 18:26
    beta-ziliani milestoned #13043
  • 18:00
    Blacksmoke16 labeled #13053
  • 17:59
    straight-shoota labeled #13053
  • 17:59
    straight-shoota labeled #13053
  • 17:59
    straight-shoota assigned #13053
  • 17:59
    straight-shoota opened #13053
  • 12:19
    straight-shoota closed #13010
  • 12:19
    straight-shoota closed #13050
  • 12:18
    straight-shoota closed #13048
  • Feb 07 18:12
    HertzDevil labeled #13052
  • Feb 07 18:12
    HertzDevil labeled #13052
  • Feb 07 18:12
    HertzDevil labeled #13052
  • Feb 07 18:12
    HertzDevil opened #13052
  • Feb 07 17:49
    straight-shoota closed #13051
  • Feb 07 17:46
    beta-ziliani milestoned #13051
  • Feb 07 17:46
    beta-ziliani milestoned #13051
  • Feb 07 14:03
    beta-ziliani review_requested #13050
  • Feb 07 13:59
    straight-shoota labeled #13051
  • Feb 07 13:59
    straight-shoota assigned #13051
George Dietrich
@Blacksmoke16
use variables, proper indenting etc
got a link to it?
It’s Horrible how it’s writed
I don’t understand my own code
George Dietrich
@Blacksmoke16
oo another framework :P
Nikolaii Lodenos
@lodenos
it’s more a library than a framework
George Dietrich
@Blacksmoke16
unfortunately there just isnt a good way to have clean macro code because you can't define reusable macro methods (yet?)
could probably just add more comments or something, id also suggest writing some tests, be easier to ensure its working at least
Nikolaii Lodenos
@lodenos
Right, thx for the anser, I hope one day we can reuse macro methods can be really powefull
George Dietrich
@Blacksmoke16
have you considered using annotations instead of the hash?
@[Cocaine::Route(path: "/", verb: "GET")]
def controller_index(context : HTTP::Server::Context, params : Cocaine::Param)
  context.response.content_type = "text/plain"
  context.response.print "Hello world, got #{context.request.path} !"
end

@[Cocaine::Route(path: "/user/:id", verb: "GET")]
def controller_user(context : HTTP::Server::Context, params : Cocaine::Param)
  context.response.content_type = "text/plain"
  context.response.print "Hello world, got #{context.request.path} !"
end


################################################################################
# Server
################################################################################

server = HTTP::Server.new { |context| Cocaine.match_endpoint context }
server.listen "0.0.0.0", 5000
Nikolaii Lodenos
@lodenos
I never try that on my own code
George Dietrich
@Blacksmoke16
looks like a good use case for them. However the downside is there isn't a way to iterate over all methods with an annotation, so would need to think of a way around that.
but :shrug: just a thought
Nikolaii Lodenos
@lodenos
With this lib I’ve only one object a bit useless
George Dietrich
@Blacksmoke16
hm?
Nikolaii Lodenos
@lodenos
George Dietrich
@Blacksmoke16
fair enough
good luck
Nikolaii Lodenos
@lodenos
I know XD
George Dietrich
@Blacksmoke16
benchmarks like that are mainly just testing the router, is fairly easy to have a faster framework, but then the framework itself isn't much of a framework
pretty sure all the crystal ones on there are using HTTP::Server, so to be faster than that you might need to get creative
https://github.com/S-YOU/h2o.cr such as binding to a c http server like this one did
Nikolaii Lodenos
@lodenos
Learn to optimize to the maximum helps to understand in detail the suptiles of the language and its conception. I can imagine.
didactic-drunk
@didactic-drunk
Why doesn't Bytes.new call GC.malloc_atomic? How does it get it's memory or any other Pointer.malloc? I'm attempting to track malloc usage and my monkey patches don't run.
@didactic-drunk: it seems that the memory allocated for pointers isn't assumed to be atomic then
atomic, as I understand, being a declaration that that memory will not contain GC-relevant pointers
for arrays a choice was made to always assume that their memory will not contain undeclared pointers, that's where u get malloc_atomic, but it's not used always
Quinton Miller
@HertzDevil
Jonathan Silverman
@mixflame
if anyone is into amber, can you please review pull request #1265 on amberframework/amber and tell me if you can spot any weaknesses? it's a multichannel redis adapter for websockets
George Dietrich
@Blacksmoke16
your link broke ^
didactic-drunk
@didactic-drunk
I monkey patched GC.malloc* and it segfaults only with -Dpreview_mt when calling an empty function. https://github.com/didactic-drunk/fiber_stats.cr/pull/1#discussion_r665800802
From IRC (bridge bot)
@FromIRC
<postmodern> so what is the difference between .as(Int32) and .to_i32 ?
George Dietrich
@Blacksmoke16
the former just tells the compiler to treat the values as an int32 without actually doing the conversion
i.e. pretty sure .as wouldn't handle over/underflows, so id deff use .to_i32, or really just .to_i
BUT, .as(Int32) can be useful if the type of your value is like Int32 | Bool and you want to tell the compiler "i know it'll be an Int32 in the case"
From IRC (bridge bot)
@FromIRC
<postmodern> ah ha, i figured that might be the case for things like UInt8 | Int32
From IRC (bridge bot)
@FromIRC
<yxhuvud> it can also be used for upcasting, like x = [1.as(Int32|String)]
Rishav Sharan
@rishavs
@lodenos , for a bigger aim, try gettiing #1 at https://www.techempower.com/benchmarks/#section=test&runid=76b9993b-3c68-4d6d-884c-fd01112e7b7a&hw=ph&test=composite&a=2
The composite score is a much better representation of normal web load
Nikolaii Lodenos
@lodenos
@rishavs Thx It’s a really good challenge
From IRC (bridge bot)
@FromIRC
<straight-shoota> Crystal 1.0 Conference is now live =) Late birds can still join at https://www.eventbrite.com.ar/e/crystal-conference-10-launch-tickets-149153252393
Rishav Sharan
@rishavs
@lodenos do keep in mind that all the tests around db queries are also test of the quality of the db drivers. And the drivers of languages like go, rust etc are far ahead of us due to their larger community size.
One way to work around this can be to wrap existing db clients in crystal instead of using our own drivers but it has its own set of cons
Nikolaii Lodenos
@lodenos
It’s always a balance btw Productivie, ez coding n Performance in run time
George Dietrich
@Blacksmoke16
We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.
Nikolaii Lodenos
@lodenos
@Blacksmoke16 100% true
From IRC (bridge bot)
@FromIRC
<terminalpusher> where is the livestream?
<terminalpusher> where can I see the livestream of the 1.0 conference? Doesn't it start right now? I can't find it anywhere at all
George Dietrich
@Blacksmoke16
did you buy a ticket?