Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 15:15
    asterite synchronize #12378
  • 14:49
    asterite synchronize #12375
  • 14:45
    HertzDevil edited #12235
  • 14:25
    straight-shoota milestoned #12242
  • 14:25
    straight-shoota milestoned #12242
  • 14:24
    straight-shoota milestoned #12244
  • 14:24
    straight-shoota milestoned #12244
  • 14:23
    straight-shoota milestoned #11226
  • 14:23
    straight-shoota milestoned #11226
  • 14:22
    HertzDevil review_requested #12244
  • 14:22
    HertzDevil review_requested #12242
  • 13:32
    HertzDevil ready_for_review #12242
  • 13:32
    HertzDevil synchronize #12242
  • 13:24
    HertzDevil ready_for_review #12244
  • 13:24
    HertzDevil edited #12244
  • 13:23
    HertzDevil synchronize #12244
  • 13:17
    HertzDevil closed #12399
  • 13:12
    HertzDevil synchronize #12282
  • 13:04
    HertzDevil synchronize #11226
  • 09:57
    straight-shoota closed #12145
dumbmahreeo
@dumbmahreeo:matrix.org
[m]
Imo calling Crystal production ready with this single problem (which is not the only one) is really v-lang level talk
George Dietrich
@Blacksmoke16
:shrug: make a forum thread about this info and see if there's any quick wins
dumbmahreeo
@dumbmahreeo:matrix.org
[m]
I forgot that Crystal had a forum. Yeah, I think that I'll start a thread
George Dietrich
@Blacksmoke16
some would argue the biggest problem is windows support, or MT not being 100% yet, etc. Doesn't mean it's not production ready
dumbmahreeo
@dumbmahreeo:matrix.org
[m]
In fact I'm not saying that's it's the biggest problem. I'm saying that it's an incredibly huge problem, yet not the biggest one
George Dietrich
@Blacksmoke16
maybe less so in some areas, but in the end is just another problem that needs solving
ddd
@Dan-Do
I am dealing with that using timeout channel atm
Kirk Haines
@wyhaines
I don't think it's really even a problem that needs to be solved. The fact that fibers do not have a pre-emptive scheduler means that one must understand that fact when writing concurrent code, but it's hardly a flaw. Insert a Fiber.yield into the loop, and it is no longer blocking.
Quinton Miller
@HertzDevil
Screenshot_20210622_142745.png
Screenshot_20210622_143005.png
soon...?
the asm output is not very useful if i include the prelude
Quinton Miller
@HertzDevil
in fact compiling anything with the prelude and --release causes a timeout
Alex Kampa
@alex-kampa

can manually do sleep 0 to somewhat get around this tho

Hi @Blacksmoke16 will "sleep 0 "have the same effect as Fiber.yield ?

@wyhaines you suggested Fiber.yield, what do you think about "sleep 0", what's the difference?
From IRC (bridge bot)
@FromIRC
<straight-shoota> It's literally the same: Fiber.yield is implemented as sleep(0)
Alex Kampa
@alex-kampa

Ok, so just to be 100% sure, the place to insert this would be as follows:

spawn do
  loop do
    server.accept do |client|
      message = client.gets
      client << process(message)
    end
    Fiber.yield # same as sleep(0)
  end
end

Is that correct?

From IRC (bridge bot)
@FromIRC
<straight-shoota> Technically, yes. But it's really not necessary at this location.
<straight-shoota> Yielding a fiber is a tool you would use in a tight loop to give the scheduler an opportunity to change to some other task.
<straight-shoota> But your loop contains I/O operations which already expose such opportunities due to their async implementation
Alex Kampa
@alex-kampa
Thanks for the clarification. Yes I noticed that it all works well without putting in the Fiber.yield.
Rishav Sharan
@rishavs
Hey @straight-shoota how goes the Windows signals work? eagerly awaiting it. :smiley_cat:
From IRC (bridge bot)
@FromIRC
<yxhuvud> straight-shoota: I wouldn't mind moving Scheduler#yield to a event loop dependent place though. I don't know about how it would work on windows but at least for uring it makes no sense to set up a timer instead of using a NOP op.
<yxhuvud> assuming there is even need to emit an op in the first place, which is questionable.
<straight-shoota> @rishavs, Windows is not exactly made for signals. We'll probably be able to imitate a few of them, but you shouldn't expect that to work as on posix systems
<straight-shoota> More info on crystal-lang/crystal#7339
<straight-shoota> yxhuvud, yeah, that's probably a good idea. Fiber.yield == sleep 0 is an implementation detail of the event loop
Rishav Sharan
@rishavs
:heart:

I just want crystal on windows so I can do some gamejams using crsfml ^_^. I am not interested in the networking bits, just hate the effort it requires to set up crystal on windows currently.
I would be happy if I can just do scoop install crystal and the compiler after installation throws a big honking text Networking is currently not supported on windows platform.

Anyway, wanted to thank you and the rest of the team on picking more big rocks on the windows side of things.

Quinton Miller
@HertzDevil
does crystal have the capability to distinguish between prelude code and user code in build artifacts
mainly asm and llvm-ir
From IRC (bridge bot)
@FromIRC
<yxhuvud> what functions would be part of the prelude?
Rishav Sharan
@rishavs
Any sneak peak on the 1.10 changelog?
Rishav Sharan
@rishavs
Thanks @jhass:m.aeshna.de !
manveru
@manveru:matrix.org
[m]
hi folks, i'm trying to parse a stream of rather large json objects without any delimiters between them from an IO... is there some sane way to do that
the only way i've found so far would be to use the JSON::PullParser and manually try to parse everything... or maybe going through the stream and counting braces, but that's also error-prone because of escaping
George Dietrich
@Blacksmoke16
can you alter the source to make them at least on unique lines?
manveru
@manveru:matrix.org
[m]
unfortunately not, i'm consuming a 3rd party api for streaming events
hmm, lemme double-check that though
ok, i must've made some mistake, it seems a simple gets on the io with a huge buffer works :)
manveru
@manveru:matrix.org
[m]
and each_line is even more elegant
George Dietrich
@Blacksmoke16
so they are delimited then?
manveru
@manveru:matrix.org
[m]
i tried IO::Delimited first, but that was probably wrong
sure looks like there are proper newlines in there, yeah
sorry for the disturbance ^^;
Quinton Miller
@HertzDevil
looking at the llvm ir and asm outputs, they do include source locations even without --debug which should be enough
because on compiler explorer there should most certainly be only one non-library source file, everything else would be considered "third-party" code
aaaScript
@aaaScript
Hi everyone. I have a quick question. Has anyone ever had an issue with closing a HTTP::Server's port when it is created in a fiber. I'll try to see if I can come up with some cleaned code but I'm basically creating an having a new HTTP Server listen while in a spawn block so that it doesn't block the rest of the program. Then later I'm trying to close it with the #close function outside of the spawn block later on. However despite that it still leaves the socket open and listening. I'm assuming it needs to be closed within the spawn block but I'm wondering if anyone has some insight on that.
From IRC (bridge bot)
@FromIRC
<straight-shoota> that should really make no difference