<FromGitter>
<Blacksmoke16> i.e. `abstract struct CustomConstraintValidator < ConstraintValidator; end` then i can check for `CustomConstraintValidator.class`
deavmi has joined #crystal-lang
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 244 seconds]
chachasmooth has quit [Ping timeout: 272 seconds]
chachasmooth has joined #crystal-lang
lanodan has quit [Quit: WeeChat 2.8]
lanodan has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter>
<mattrberry> Wow Ary, thank you so much for looking into that. I think that's so cool that you guys are still at a point where you're happy to help people out with their projects directly
<FromGitter>
<mattrberry> > I wish we could optimize such constants... but I don't know how to detect these cases... maybe some other core team members, like waj and brian, can think of a solution ⏎ ⏎ That would be awesome if possible, but I have plenty of other ways to optimize in the meantime by just getting rid of the constants, even if it doesn't look quite as nice
Vexatoast has joined #crystal-lang
<FromGitter>
<mattrberry> > I think doing `n <= index <= y` instead of using a constant range is your best bet... until the compiler gets smarter. Range is a nice convenience but right now not very good in hot paths ⏎ ⏎ One way I could optimize that would just be to `case` over a bit or two in the address, as that's enough to determine where the direct the read/write. That would eliminate the .includes? at least
Vexatos has quit [Ping timeout: 260 seconds]
<FromGitter>
<mattrberry> > Then there's an optimization we can do in the stdlib: array and deque#clear will clear out the memory so the GC can collect references... but that's not needed if the array or deque just holds numbers ⏎ ⏎ In the meantime, I assume just writing into an array and keeping track of the pos would be the best approach? Easy enough optimization for now at least!
<FromGitter>
<mattrberry> > Also, where can I see the FPS? ⏎ ⏎ Just pushed a change that shows it in the window title!
<FromGitter>
<mattrberry> Wow, inlining the constants *alone* just increased the framerate from ~40 to ~100. That's wild.. I use constants all over CryBoy, I wonder what I could get my fps to over there by simply inlining those constants....
Vexatos has joined #crystal-lang
Vexatoast has quit [Ping timeout: 260 seconds]
robacarp has joined #crystal-lang
r0bacarp has quit [Ping timeout: 240 seconds]
<FromGitter>
<Dan-Do> wow, amazing!
gangstacat_ has joined #crystal-lang
gangstacat has quit [Ping timeout: 240 seconds]
f1reflyylmao has quit [Quit: bye fags]
f1refly has joined #crystal-lang
_whitelogger has joined #crystal-lang
sagax has joined #crystal-lang
<FromGitter>
<Dan-Do> Can I check if a class is a Enum?
<FromGitter>
<Dan-Do> Enum is a class, not a struct :)
<FromGitter>
<naqvis> `abstract struct Enum `
<FromGitter>
<naqvis> I assume you missed the top heading :P
<FromGitter>
<Dan-Do> My bad :)
<FromGitter>
<naqvis> :P
<FromGitter>
<Dan-Do> abstract struct Enum < abstract struct Value < abstract class Object
<FromGitter>
<naqvis> true `Object` is the base type of all types in Crystal
<FromGitter>
<naqvis> but it differentiate between reference (class) and value (struct) types
<FromGitter>
<naqvis> all struct descendants are value types (immutable)
<FromGitter>
<Blacksmoke16> `.struct?` is `type.class? && type.struct?`
<FromGitter>
<Blacksmoke16> which wouldnt be true for an enum i think
<FromGitter>
<naqvis> aah so that `TypeNode` methods are for keywords? things declared via `struct` keyword will get the value of `true`
<FromGitter>
<Blacksmoke16> essentialy yea
<FromGitter>
<Blacksmoke16> they're part of the internal AST, and just exposed via methods on `TypeNode`
<FromGitter>
<naqvis> if that's the case, then it make sense, but then `TypeNode` is missing method for `enum` as it does cover `class`,`struct`,`module` but not `enum`
<oprypin>
"inlining the constants" really sound s like something you shouldnt have to do 😞
alexherbo2 has quit [Ping timeout: 256 seconds]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
alexherbo2 has joined #crystal-lang
<FromGitter>
<Daniel-Worrall> what exactly does inlining the constants mean in this context
<oprypin>
Daniel-Worrall, i think, instead of `A = 5; use(A)` you write directly in code `use(5)`
<FromGitter>
<Daniel-Worrall> yikes, that should definitely not affect performance
<FromGitter>
<asterite> the problem is that a constant might be used before the codegen phase reaches it (reaches the line where it's define). And that can happen inside a method. So, almost all constants (except some literals) are lazily initialized. I'd like to find a way to detect whether a constant could be initialized at the beginning of the program, but I don't know how. Also, lazily initialized constant might be good for a
<FromGitter>
... quicker startup. Again, I'd like to improve this but at this point I'm not touching the compiler anymore
<FromGitter>
<asterite> I think I just thought of a way... I'll try it later today or tomorrow
alexherbo2 has quit [Ping timeout: 260 seconds]
alexherbo2 has joined #crystal-lang
<FromGitter>
<Blacksmoke16> Good ol' ary. "Nope it's impossible" "Oh wait I fixed it"
alexherbo2 has quit [Ping timeout: 258 seconds]
<FromGitter>
<asterite> And then "Ah, no, I forgot about this case" :-D
<FromGitter>
<asterite> It's nice to see that most activity lately is the discussion about neutral language... sigh...
alexherbo2 has joined #crystal-lang
DTZUZU_ has joined #crystal-lang
DTZUZU has quit [Ping timeout: 258 seconds]
<FromGitter>
<asterite> Meh, I don't have time anymore to code the compiler with time...
<FromGitter>
<Blacksmoke16> 😢
<yxhuvud>
asterite: sigh, I just avoid that thread. I feel like it actively makes people more stupid, and it doesn't help that a sizeable share of the people in it are trolling.
<FromGitter>
<Daniel-Worrall> I'd like to see some common method "did you mean"s like I tried to use `#contains?` for Array when I wanted `#includes?`
<FromGitter>
<Daniel-Worrall> Can I set a lazily instantiated class variable without the getter method?
<FromGitter>
<Daniel-Worrall> like class_getter but without getting the getter method
<FromGitter>
<Daniel-Worrall> and passing the block
<FromGitter>
<Blacksmoke16> When would it be initailized? When you call another method?
<FromGitter>
<Daniel-Worrall> hm
<FromGitter>
<Daniel-Worrall> good point
<FromGitter>
<Daniel-Worrall> I want to initialize it in a class method, but I don't want it nullable
<FromGitter>
<Daniel-Worrall> so I have a `def self.init_var(opts)`
<FromGitter>
<Daniel-Worrall> and if that doesn't get called, the other methods just use one with default args
<FromGitter>
<Blacksmoke16> Pretty sure lazily initailized is nullable behind the scenes
<FromGitter>
<Daniel-Worrall> it is...
<FromGitter>
<Daniel-Worrall> I guess I want a private class method
<FromGitter>
<Daniel-Worrall> so it's not callable from like MyClass.var