ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.23.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
hightower3 has joined #crystal-lang
hightower4 has quit [Ping timeout: 240 seconds]
<watzon> Crystal is making an appearance in my new coming soon page http://watzon.me/
<watzon> Lol
wontruefree has quit [Quit: The Internet needs a break and I need a cookie]
wontruefree has joined #crystal-lang
wontruefree has quit [Client Quit]
wontruefree has joined #crystal-lang
wontruefree has quit [Client Quit]
_whitelogger has joined #crystal-lang
<FromGitter> <ethagnawl> Hi. Any other raspian users seeing GPG signature errors when running `apt update`? (e.g. `W: GPG error: http://public.portalier.com raspbian/ Release: The following signatures were invalid: BADSIG D5581943005FAF9E Portalier Julien (Debian Packages Sign Key) <julien@portalier.com>`) I can try contacting Julien, but don't want to spam them if it's a known issue.
<crystal-gh> [crystal] straight-shoota opened pull request #5123: Add custom time format implementations (simplified) (master...jm-time-formats-simplified) https://git.io/vd1Pc
<crystal-gh> [crystal] straight-shoota closed pull request #5084: Add custom time formats (master...jm-time-formats) https://git.io/vd0SR
<crystal-gh> [crystal] straight-shoota closed pull request #4729: Add formatters and parsers for standard time formats (master...time-formats) https://git.io/v7e1M
jackivan88 has quit [Remote host closed the connection]
jackivan88 has joined #crystal-lang
maxpowa has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snsei has joined #crystal-lang
Creatornator has joined #crystal-lang
snsei has quit [Ping timeout: 258 seconds]
Creatornator has quit [Client Quit]
_whitelogger has joined #crystal-lang
Creatornator has joined #crystal-lang
<FromGitter> <coderhs> hey is there an equivalent of `.change` method for Time object in crystal? https://apidock.com/rails/Time/change
snsei has joined #crystal-lang
<FromGitter> <coderhs> I know its a rails method, but is there any in build method that could achieve the same
snsei has quit [Ping timeout: 255 seconds]
lacour has quit [Quit: Leaving]
LOLBOW is now known as hallomann
Groogy_ has quit [Ping timeout: 248 seconds]
Groogy_ has joined #crystal-lang
<FromGitter> <coderhs> quick question, how do we pass in keyword arguments in crystal and expect it also accept nil?
<FromGitter> <coderhs> if no argument is passed.
_whitelogger has joined #crystal-lang
<FromGitter> <bararchy> Is there a way to accept string representing a regex and pass it to #match as a real regex ? (As in "/too/I" and pass it to #match(/too/I) )
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_whitelogger has joined #crystal-lang
alex`` has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
_whitelogger has joined #crystal-lang
<FromGitter> <bararchy> Papierkorb That's a really helpfull message, how did you ditected that QT is missing ?
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
wontruefree has joined #crystal-lang
<crystal-gh> [crystal] firejox opened pull request #5124: Make StaticArray and Slice .map to return their own type (master...add_map_for_slice_and_static_array) https://git.io/vd1Q1
<FromGitter> <monouser7dig> https://github.com/crystal-lang/crystal/issues/5124 ⏎ there was someone telling this was not possible because of resizing issues? Groogy I think? ⏎ but it is? cause: ` but I guess optimizing that for StaticArray and Slice would be a good idea (one can invoke to_a at the end if you need an array in the end).`
claudiuinberlin has joined #crystal-lang
<FromGitter> <Rinkana> Morning :)
_whitelogger has joined #crystal-lang
<Groogy> with #map you can know the size, but things like #select you can't
<Groogy> hmmm it would be nice if it is posssible to have a sort of function that is "If you feel like it, run gc collection now"
<Papierkorb> Groogy: `GC.collect`
<Groogy> i.e not commandment but give the gc a hint "now is a good time"
<Papierkorb> that's what that method is
<Groogy> ah cool
<Papierkorb> Or at least it doesn't promise to do everything iirc
<Papierkorb> at least those objects with a finalize will be marked only, and then collected in the next cycle
<Papierkorb> Groogy: It's actually a tad annoying if you want to test a #finalize implementation. Calling it 10 times worked for me reliably until now, but .. yeah
A124 has quit [Read error: Connection reset by peer]
<Groogy> hmm so I could potentially tell it to call the GC inbetween game ticks when not running highest speed on simulation to try and not let temp arrays etc build up
<Groogy> i.e not trigger a big cycle collection while we are expected to respond to user interaction
<Papierkorb> I'm actually interested if that gets you any real benefit
A124 has joined #crystal-lang
<Papierkorb> Groogy: You could time the collect call to see if it takes too long when it happens at random
<Papierkorb> (Dunno if boehmgc has a timing hook)
<Groogy> maybe, I'll look into the debugging utility for GC later
<Groogy> or maybe I should do that now
<Groogy> since preferably you would want to know where you are doing the tmp arrays to try and eliminate it if possible
<Papierkorb> If you chain #map and #selects and stuff, add a non-yielding #each before it. that should get rid of any immediate arrays
<Papierkorb> `foos.each.select(&.bar?).map(&.baz).to_a`
<FromGitter> <sdogruyol> morning everyone
<Papierkorb> Morning
<Groogy> yeah but that could be hard to find in a good code base :P
<Groogy> would be nice to just have a tool that tells you "array allocated here free'd"
<Papierkorb> Groogy: Well if you actually want to *find* those, that'd be a job for static code analysis
<Groogy> or a plugin tool to the GC ;D
<Papierkorb> Timing the GC can only tell you that you just shoot yourself into your foot
<Papierkorb> code analysis can warn you long before anything bad happened
<Papierkorb> I mean, GC timing is so easy to do, that as failsafe it's fine
<Groogy> well the static analysis can tell you that it is going on here, but it might not amount to anything because in runtime it is not invoked that much
<Groogy> runtime analysis would give you proper hotspots
<Papierkorb> Profiling, sure
<Groogy> that's what I am talking about yeah :P
<Papierkorb> valgrind to the rescue
<Groogy> oh true but this would work a bit quicker than valgrind
<Groogy> main problem I have though looking at it is that crystal don't seem to provide the type when it allocates stuff :/
<Papierkorb> Looks like it'd be time to cram out my GC prototype and get it somewhat working
<Papierkorb> That one can tell you. Well, it has to know itself. Required some hacks though >_>;
<Groogy> yeah I should be able to technically do everything in Crystal land, the issue is just that the allocation methods don't know type or location when allocating which would be needed
<Groogy> could potentially fake it with the callstack from an exception...
<Papierkorb> Oh you can know it. You just have to hook the default #new, so perfectly easy to get right /s
<Groogy> <_< yeah....
<Groogy> I tried finding the default #new
<Groogy> is it generated?
<Groogy> I can't find it anywhere in the source when I was looking around
<Papierkorb> It is, but you can provide your own and in that case, it won't override it
<Papierkorb> Totally breaks some special structures though
<Groogy> yeah no
<Groogy> I think I'll just go for storing callstack
<Groogy> actually yeah gonna start this now
<Papierkorb> That'll be a huge burden on performance and memory
<Papierkorb> callstack unwinding is expensive
<Groogy> I know :/
<Groogy> but like new() won't know location where it is called either right?
<Groogy> there's no callee macro or something?
<Groogy> caller macro*
<Papierkorb> {{@type}}
<Groogy> no I mean file location
<Papierkorb> __FILE__
<Groogy> yes but that will give #new's place
<Groogy> not where new is getting called
<Papierkorb> wasn't there TypeNode#source_file or something?
<Groogy> yeah but then you still need to access caller somehow
<Groogy> huh curious
<Groogy> what's the difference between a def and a fun? (a fun outside of a lib definition)
A124 has quit [Read error: Connection reset by peer]
<oprypin> Groogy, fun is a function using C ABI
<oprypin> so the type has to be exact, and the function is exportable
<Groogy> alright
<FromGitter> <monouser7dig> Groogy ah yes ok
<Groogy> hmmm so backtrace crashes while allocating :/
<Groogy> ah it seems to be when I applied to arrays
<FromGitter> <ansarizafar> @watzon is it a new shard ⏎ ⏎ ```require "html/dom"``` [https://gitter.im/crystal-lang/crystal?at=59e33ae8210ac26920ea90a1]
<watzon> @ansarizafar lol no, personal site I'm building. Just needed a Coming Soon page
<FromGitter> <bararchy> So, I'm using something like this to try and gather all the names of parameters from forms in the url, what logic can I use to recursivly go over all childrens and there childrens ... etc.. https://play.crystal-lang.org/#/r/2wpj
<oprypin> `where_tag` huh
<FromGitter> <bararchy> not good ? as i'm looking for forms in the url, it seems like the right approch :) or you just happy to see we have it ? :)
<oprypin> bararchy, I am thinking that using `where_tag` prevents you from thinking in the right direction
<FromGitter> <bararchy> why is that ?
<FromGitter> <bararchy> should I just node each ?
<oprypin> weird to see `tag.node`. what's the difference between tag and node then?
<FromGitter> <bararchy> I guess tag is an HTML, then, you get an XML node for each tag
<FromGitter> <bararchy> I'm using: https://github.com/madeindjs/Crystagiri
<oprypin> bararchy, https://carc.in/#/r/2wpn
<oprypin> this is basically unrolled recursion
<FromGitter> <bararchy> Really nice !
<FromGitter> <bararchy> thanks oprypin, works great
<Groogy> is there a way with macros to figure out if a previous_def is available or not?
<FromGitter> <bararchy> So, GC isn't cleaning ?
<Groogy> what no it's me tracking allocations and deallocations
<Groogy> with a callstack on the allocation
<FromGitter> <bararchy> but I see no de-allocations
<FromGitter> <bararchy> or you just leave everything in scope
<FromGitter> <bararchy> or saved
<Groogy> yeah it's allocations created by the system
<FromGitter> <bararchy> etc..
<Groogy> i.e the language itself and my own ones
<FromGitter> <bararchy> cool
<FromGitter> <bararchy> how can you handle green in the terminal ? XD
<Groogy> code is literally just GCProfiler::Analyzer.new.print_stats
Creatornator has joined #crystal-lang
<Groogy> just need to figure out how to do "oh there is a prev def of finalizer, call it" with macros
<Groogy> hmm how should I measure average life time? Should objects who are alive be part of that or should it only count objects after they've died?
<FromGitter> <bew> Groogy about prev def, I think you could just check that the method exists (hopefully it won't take the one you're writing into account)
<Groogy> hopefully, doing it in an include macro
<FromGitter> <bew> Hmm you probably want to add your finalizer at the end of all macro expansion and stuff, to be sure the check is correct, iirc there is a hook called finished or sth luke that, that allows you to do macro stuff after everything is defined
<Groogy> well right now I am doing it as a include of a module to only track the stuff you are interested off
<Groogy> but might need to do it with finished
<Groogy> to encompass everything
<Groogy> oh right shit it can't deallocate the memory because I keep references to it, duh
<18VACHU47> [crystal] RX14 closed pull request #5120: Prevent to type ivar having initializer as nilable on assignment (master...fix/crystal/5112-not-type-ivar-having-initializer-as-nilable) https://git.io/vd138
<DeBot_> https://github.com/crystal-lang/crystal/pull/5120 (Prevent to type ivar having initializer as nilable on assignment)
<07IABHPCV> [crystal] RX14 pushed 1 new commit to master: https://git.io/vd1h7
<07IABHPCV> crystal/master 906a8cb TSUYUSATO Kitsune: Prevent to type ivar having initializer as nilable on assignment (#5120)...
<DeBot_> https://github.com/crystal-lang/crystal/pull/5120 (Prevent to type ivar having initializer as nilable on assignment)
<Papierkorb> Groogy: WeakRef
<Groogy> says undefined constant for me :/ is it a 2.4 one only?
<Papierkorb> require "weak_ref"
<Groogy> ah thx
<Papierkorb> It's also useful to break a dependency chain when A has an instance of B, and B points back to A, and both A and B have a #finalize
<Papierkorb> Without a weak ref, boehm prints unhappy warnings :P
<Groogy> yeah I've seen those
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vd1jv
<crystal-gh> crystal/master 22c09d1 Ihor Tsykalo: Remove the possibility to require big_*. Leaving only with require "big" (#5121)...
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Groogy> erhm seems to be a compile erorr in the weak ref unless I am using it wrong
<Groogy> the value method tells me I can't cast Void* to Void* | Nil
<Papierkorb> ... How are you using it?
ShalokShalom_ has joined #crystal-lang
<Papierkorb> WeakRef is for Reference's
<Groogy> yeah my code is for as well, but hmm
<FromGitter> <sdogruyol> it makes me happy to see that we have more people sending PRs to compiler
<Papierkorb> I'd simply copy WeakRef and modify as needed
<FromGitter> <sdogruyol> thanks @MakeNowJust and @iSarCasm 🙏
<FromGitter> <sdogruyol> P.S: We have 250+ commits upon 0.23.1 🏄
ShalokShalom has quit [Ping timeout: 255 seconds]
<Groogy> well I need to compare
<Groogy> if I am tracking the pointer
<Papierkorb> compare?
<Groogy> yeah, I need to check "am I killing this object?" and stop tracking it and record the time of death
ShalokShalom_ is now known as ShalokShalom
<travis-ci> crystal-lang/crystal#906a8cb (master - Prevent to type ivar having initializer as nilable on assignment (#5120)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/288182202
<DeBot_> https://github.com/crystal-lang/crystal/pull/5120 (Prevent to type ivar having initializer as nilable on assignment)
<travis-ci> crystal-lang/crystal#22c09d1 (master - Remove the possibility to require big_*. Leaving only with require "big" (#5121)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/288183269
<DeBot_> https://github.com/crystal-lang/crystal/pull/5121 (Remove the possibility to require big_*. Leaving only with require "big")
<Papierkorb> Someone knows of any github project, that uses system icons to show what systems it supports?
<Groogy> I need a good project name, right now its just called "GCProfiler"
<Papierkorb> ObjectJockey
<Groogy> haha
<Papierkorb> Jesus rebooting a win10 VM is taking ages
<Papierkorb> "Please wait while we're sending your private data off to the NSA cloud"
<FromGitter> <sdogruyol> @Papierkorb are you working on Crystal Windows support or qt5?
<FromGitter> <sdogruyol> @Groogy I've an awesome name for you
<FromGitter> <sdogruyol> crofiler - Crystal Profiler
<Papierkorb> sdogruyol, with the recent changes, I'm interested if I can get Qt5.cr to work on Windows.
<Papierkorb> I'm using mingw though, can't be bothered to learn about msvc
<Papierkorb> someone who cares could do that
<FromGitter> <sdogruyol> btw I just started evaluating survey results
<FromGitter> <sdogruyol> FYI
<FromGitter> <bararchy> oh cool !
<FromGitter> <bararchy> @sdogruyol when are you planing to share them ?
<FromGitter> <sdogruyol> I'd like to finish my part today
<FromGitter> <sdogruyol> Then will ping other
<oprypin> Papierkorb, what modification of Crystal do you want to use?
<FromGitter> <bararchy> really nice, interesting statistics ?
<FromGitter> <sdogruyol> @bararchy very interesting indeed
<FromGitter> <sdogruyol> we've got a total of 757 responses
<FromGitter> <bararchy> I'm really interested what was #1 wanted feature
<Papierkorb> oprypin: Anything that lets me link a cross-compiled .o on Windows
<Papierkorb> I'm interested to see if/what works, not as much as getting it shiny on Windows. That'd require a proper native Crystal compiler on Windows.
<oprypin> Papierkorb, thing is, the development that was happening was done for msvc, maybe mingw is not supported
<FromGitter> <bararchy> oprypin didn't you manage to run a game on Windows ?
<oprypin> sure
<Papierkorb> oprypin: I'll see. if it doesn't work, I drop it.
<Papierkorb> Simple as that
<FromGitter> <sdogruyol> @bararchy seems like it's parallelism / windows support
<FromGitter> <bararchy> makes sense
<FromGitter> <bararchy> no suprise there
<FromGitter> <sdogruyol> yeah, also more refined generics e.g
<oprypin> this is the Crystal that could run crsfml, and the 2nd link is my attempt of running qt5.cr
<Papierkorb> Breaks for LLVM 5.0
<oprypin> yeah i suppose. this was in 3.9 times
<Groogy> @sdogruyol nice though it is only memeory profiling :P
<Groogy> or specifically GC profiling I guess
<Groogy> cromfiler?
<FromGitter> <sdogruyol> sounds good
<Papierkorb> trashman
<FromGitter> <sdogruyol> lol
<Papierkorb> trashtrack .. would actually be kinda accurate
<FromGitter> <sdogruyol> crfree
<oprypin> Papierkorb, i mean you could try merging latest crystal but it's probably not worth it. or, i dunno, maybe by some miracle official latest crystal would just work
<Papierkorb> what's the target triplet?
<Groogy> oh I do like TRashman actually
<Groogy> so should I try and figure out so it hooks in on every type or should it be optional opt in like: Class Array; include Trashman; end;
<Papierkorb> Your changes are super intrusive, prefer opt-in
<Groogy> yeah think so to
<FromGitter> <bararchy> Groogy did you build a new GC or something ? or a profiller ?
<Groogy> profiler on allocations/deallocations yeah
<FromGitter> <bararchy> Oh, yeha, the one you showed before, is it in a shard ?
<Groogy> in a second
<Groogy> need to add some more utilities to it though
<Groogy> like in the analyzer, let you sort based on what you want etc.
Creatornator has joined #crystal-lang
<FromGitter> <asterite> Cool! It would be nice for our Benchmark module
<FromGitter> <asterite> to show allocated bytes, like they do in Go
<Groogy> Yeah I was thinking of this more as a proof of concept, when I have more time maybe do a pull request. Right now it only supports objects specifically
<Groogy> not malloc'ed data
<Groogy> a Benchmark.ips { |x| x.track(Type); x.report("stuff") { do_stuff } }
<Groogy> might be something
<FromGitter> <asterite> Oh, I meant as something unrelated to that. Probably using the GC stats or some other hook, not finalizers
<Groogy> well yreah, right now I am using finalizers
<Groogy> instead of forking Crystal
<Groogy> it would still need to add a finalizer to the GC I think, unless the GC has a "whenver ANYTHING gets collected" callback
<Groogy> which I couldn't find at least
<Yxhuvud> speaking of gc and benchmarks, it would be nice if the benchark module included ways to show median and percentiles.
<Yxhuvud> The hardest part there is to not have the benchmark influenced by the accounting of that.
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Creatornator has joined #crystal-lang
<RX14> well what we do currently in ips is try to find the number of iterations needed to get close to a time t
<RX14> so we say we want 10ms of iterations and find a n which will give us about that
<RX14> and measure n
<RX14> and measure the time it takes to do n
<RX14> essentially we try to limit the overhead of Time.now
<RX14> because we don't do it even nearly once per iteration unless it's like 100ms a pop
<RX14> so the accounting isn't really an issue
<RX14> it's just that at high IPS rates we're measuring the average of a sample of the actual time distribution
<RX14> not the times itself
<Yxhuvud> Right. I suppose it would make more sense for benchmarking operations in the millisecond range rather than for the microsecond range.
<Groogy> added so it calculates a "poltergeist" score now
<Groogy> actually never mind it isn't giving what I wanted
<Groogy> there that will have to be enough for today
olbat has joined #crystal-lang
olbat has quit [Changing host]
olbat has joined #crystal-lang
Groogy has quit [Quit: WeeChat 1.9]
<oprypin> Groogy_, why do you use pastebin.com? it's the pastebin with the biggest number of downsides
olbat has quit [Read error: Connection reset by peer]
<RX14> can anyone else try compiling the compiler with make crystal debug=t release=t
<RX14> i get a LLVM crash
<RX14> which means to me that the full line debug into is broken, again.
<RX14> s/again/like always
<oprypin> RX14, instructions unclear
<RX14> `make crystal debug=t release=t` on master
<RX14> is that unclear?
<oprypin> without quotes yes
<RX14> :(
<oprypin> i have no idea why that command looks that way
<RX14> what do you mean?
<oprypin> mostly the `=t` parts and why there are multiple arguments
olbat has joined #crystal-lang
<RX14> it's just debug=true and release=true
<RX14> make <targets> [<var=val>...]
<oprypin> well it's taking a long time but no crash so far
<RX14> well yeah it took a while for me
<RX14> about 6 mins
<oprypin> O_o
<oprypin> why define both debug and release?
<RX14> to get a release build with per-instruction source lines
<RX14> for profiling
<oprypin> meh
<RX14> you always want to profile a release build
<RX14> but you also want maximum debug info
<oprypin> Invalid memory access (signal 11) at address 0x1c
<RX14> yup
<oprypin> where to look for the cause?
<oprypin> is it the compiler version or the compiled version
<RX14> ??????
<Papierkorb> Can I tell crystal where to find its lib/?
<RX14> Papierkorb, CRYSTAL_PATH
<RX14> must include stdlib location and should inlude lib folder
<FromGitter> <asterite> Is that with 0.23.1 or with the compiled compiler?
<oprypin> asterite, it's when using 0.23.1 to compile latest and when using latest to compile latest
<oprypin> includes llvm 3.9 and 5.0
<RX14> @asterite my first thought would be we're doing something wrong with full debug compared to just function debug info
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <asterite> Probably. Probably worth reporting a bug
<FromGitter> <asterite> I'm thinking of creating a label for bugs that
<RX14> i think the corrent github labels are a bit rubbish
<RX14> we seem to only really ever use topic:stdlib or topic:compiler
<oprypin> also includes 0.23.1 compiling 0.23.1
<RX14> and the type: labels are ambiguous
Creatornator has joined #crystal-lang
pabs has quit [Ping timeout: 258 seconds]
<FromGitter> <asterite> I was thinking we need a label for when the compiler generates incorrect code
<FromGitter> <asterite> Those are the worst bugs and should be fixed first
<RX14> well this is admittedly a rare case: full debug info and release mode
pabs has joined #crystal-lang
gcds has joined #crystal-lang
gcds has quit [Client Quit]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snsei has joined #crystal-lang
<RX14> 5% of crystal compiling itself compilation time is Bytes#hash lol
<RX14> 17% is libgc
<RX14> oops
<RX14> actually 30%
Creatornator has joined #crystal-lang
<vegai> how do you profile crystal?
<RX14> either perf or callgrind
<vegai> you're on Mac?
<Yxhuvud> rx14: one trick that is used for ruby on rails is to set the initial size of the heap to slightly less than it uses when everything is fully running. Would something similar work for crystal? That would probably lessen the amount of gc passes.
<RX14> no...
<RX14> perf is a linux tool
<vegai> ah, right
<RX14> Yxhuvud, yeah that doesnt work for a compiler
<RX14> because you don't have a clue what you're going to compile
<RX14> there is no steady state memory
<RX14> it's a oneshot tool which is expected to work for projects of all sizes
<RX14> whether it takes 10mb to compile of 4gb
<RX14> This command worked for compiling crystal for me:
<RX14> i mean profiling
<RX14> `` CRYSTAL_PATH=`pwd`/src CRYSTAL_HAS_WRAPPER=true valgrind --tool=callgrind --dump-instr=yes --collect-jumps=yes --separate-threads=yes --cache-sim=yes --branch-sim=yes --simulate-hwpref=yes .build/crystal build --progress --no-codegen -o .build/crystal s
<RX14> rc/compiler/crystal.cr -D without_openssl -D without_zlib ``
<RX14> takes about 30 minutes
<vegai> profiling crystal seems like it would be a good blog article
<RX14> on osx: just use instruments
<RX14> after ensuring you compile with --debug --release flags
<Yxhuvud> rx14: it could work for the special case of compiling the compiler though.
<RX14> @asterite after i've profiled this, I truly believe we can have some fantastic compiler speed wins simply by hyperoptimizing hash performance
<RX14> we spend a lot of time in Hash/Hasher/#hash in the compiler
<Yxhuvud> can you see where most of the hash calls originate? Perhaps it is possible to redo something so that it isn't necessary?
<RX14> @asterite I'm also seeing non-inlined calls to Slice#unsafe_at which is marked AlwaysInline
<RX14> so that looks like a bug
<RX14> MainVisitor#merge_if_vars is quite a hotspot
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<Yxhuvud> hmm that loop starts by doing 5 lookups for every var. If the cost of that hash function is nontrivial perhaps it would be a good idea to figure out a way to memoize it.
lacour has joined #crystal-lang
<RX14> given ahshing is such a high cost, perhaps the compiler should replace Hasher with a custom implementation which is prone to hashdos
<RX14> since hashdos against the compiler is hugely impractical
<RX14> im surprised at how badly LLVM has inlined this actually
<Yxhuvud> a lot of the methods are so large it may have problems analyzing it?
<RX14> no
<RX14> its really small methods
<Yxhuvud> ah you are looking at hasher. I'm looking at merge_if_vars, which is many things, but small ain't one.
<RX14> yep
<RX14> if Bytes#hash had 0 call overhead it would probably save a bit
<oprypin> RX14, was the change to hasher a considerable regression or was it the same before?
<RX14> like - even unsafe_at isn't inlined
<RX14> oprypin, im not sure
<RX14> i was thinking of testing that
<RX14> but im having way too much fun in kcachegrind
<RX14> now if only i could configure it to use intel system
<RX14> intel syntax*
<RX14> LLVM seems to have simply run out of inlining budget entirely somehow
<RX14> since it ingores even AlwaysInline
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Creatornator has joined #crystal-lang
wontruefree has quit [Quit: The Internet needs a break and I need a cookie]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Creatornator has joined #crystal-lang
<vegai> callgrinding the compiler sure takes a while :=)
<vegai> I guess I should re-appreciate asterite's points about slow compilation
<RX14> yeah callgrind traps all memory accesses
<RX14> either it's in a VM
<RX14> or it's nearly as slow since all memory accesses are virtualized
<RX14> im not sure myself
<RX14> but either way its about 100x slower
<vegai> it's been a while since I used *grind products last time
<RX14> valgrind is way faster than callgrind lol
<vegai> loved Valgrind since it turned me from a totally destructive C programmer to an ok beginner one :P
<vegai> I guess valgrind is the biggest reason why I'm unable to take those people seriously who claim that good tools are not very important in programming
<FromGitter> <Rinkana> Is there a default implementation for a `clone` method? `dup` is not what i need as it re-uses nested objects
<FromGitter> <Rinkana> Hmm, weird
<FromGitter> <Rinkana> It seems that it should work
snsei has quit [Remote host closed the connection]
<oprypin> Rinkana, there is no default clone
<FromGitter> <Rinkana> `pointerof` was throwing me off for a sec there.
<crystal-gh> [crystal] RX14 closed pull request #5122: Upgrade Unicode to 10.0.0 (master...upgrade-unicode-to-10.0) https://git.io/vd1gB
<FromGitter> <monouser7dig> https://play.crystal-lang.org/#/r/2wqs
<FromGitter> <monouser7dig> how did you solve it?
<FromGitter> <monouser7dig> ah I should have changed dup to clone
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vdMsh
<crystal-gh> crystal/master af06abd Firejox: Make StaticArray and Slice .map to return their own type (#5124)
<travis-ci> crystal-lang/crystal#a4f8161 (master - Upgrade Unicode to 10.0.0 (#5122)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/288257224
<DeBot_> https://github.com/crystal-lang/crystal/pull/5122 (Upgrade Unicode to 10.0.0)
Creatornator has quit [Ping timeout: 260 seconds]
<travis-ci> crystal-lang/crystal#af06abd (master - Make StaticArray and Slice .map to return their own type (#5124)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/288259472
<DeBot_> https://github.com/crystal-lang/crystal/pull/5124 (Make StaticArray and Slice .map to return their own type)
<Papierkorb> Erm, does anyone know why an iPhone would refuse to correctly download (and detect) a zip file? Only iphone has this issue, it seems to ignore the Content-Type completely
<Papierkorb> .. do they even support zips?
<livcd> hmm
<livcd> trying to find smh in dropbox for you :)
snsei has joined #crystal-lang
<livcd> hmm i guess you cant
<livcd> not without a specialized app
<Papierkorb> Thanks for trying! ... And well that sucks
snsei has quit [Client Quit]
<Papierkorb> No wonder that certain people have been complaining how my share links never worked. >_>;
<livcd> wait a second
<livcd> i just opened an invoice in gmail.app
<livcd> that was inside .zip
<Papierkorb> so you can't download a zip in the browser, but mailing works?
<livcd> well the only zips i ever open on iphone must be invoices :)
<livcd> so i dunno
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
Groogy has joined #crystal-lang
<RX14> yet more reasons i wont buy an iphone
<FromGitter> <asterite> I think even a custom Hash class just for the compiler will already optimize things. Or not using a Hash at all in many places (much harder) . Or doing linear lookup for small hashes instead of computing hash code. I know there are many optimizations to be done, but in Mac it's harder to profile the compiler so I don't do it
<RX14> @asterite i've heard people just using xcode instruments works
<FromGitter> <asterite> And AlwaysInline is just an llvm hint. Probably the compiler should inline some things regardless of of llvm
<RX14> well i find it weird that such small functions, especially with an inline hint, were not inlined
<RX14> and it's in such a hot path
<RX14> it's a shame
<FromGitter> <asterite> I always get the bottleneck at Call#recalculate but that doesn't tell me anything. Plus I'm more worried about semantic and codegen bugs. And these are just optimizations that won't matter if you keep growing your code base
alex`` has quit [Quit: WeeChat 1.9.1]
<FromGitter> <asterite> Later I'll try to see why llvm doesn't inline that.
<Groogy> hmm I would love to kind of... translate a type to a position in a tuple or a hash :/
<FromGitter> <monouser7dig> Papierkorb at least in ios11 you can download them into the so called 'files' app that comes by default, just cannot unzip them but there are free and good apps that also so that (and also archive) like 'documents'
<Groogy> right now all I can think of is a switch where each type corresponds to method call but that seems bit inflexible
<oprypin> Groogy, i dont get what you're trying to do
<Groogy> type of a variable -> look up an object that holds code for doing things corresponding to that type
<Groogy> though those objects in second part are the same base
<crystal-gh> [crystal] RX14 opened pull request #5129: Ensure FormData::Builder field value is a String (master...bugfix/multipart-builder-tos) https://git.io/vdMBT
<Groogy> donno if that's clearer
<oprypin> Groogy, that's a method on the object
<oprypin> and if not on the object, just use method overloads and dispatch
<Groogy> something like that
<Groogy> I know I can do it with switches though
<Groogy> i.e that works of course, but I am curious if I can make it in a way that is more expandable
<oprypin> i just said
<Papierkorb> *cough* SOLID
<Papierkorb> https://octoverse.github.com/ they have a somewhat sensible way of measuring language popularity. if we make it into the top15, then it'd be fair to throw "we're mainstream durr" claims around :)
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
<Groogy> holy crap that's a lot of javascript
<Papierkorb> TL;DR: ^
rohitpaulk has joined #crystal-lang
<FromGitter> <krypton97> Does crystal call c the same way rust does?
<FromGitter> <krypton97> To be more explicit, the same way if you'd run c
_whitelogger has joined #crystal-lang
<FromGitter> <krypton97> Impressive, when 1.0 comes out, it'll rock
<wmoxam> Any idea when the next Crystal release will be?
<wmoxam> I'd like to get it working on OpenBSD 6.2, but it only has a port for LLVM 5.0. I'd rather not have to patch 0.23.1 with LLVM updates :p
rohitpaulk has quit [Ping timeout: 240 seconds]
<Groogy> heh nice, with Trashman I've already found some references that stook around when they should have been removed
<Groogy> nice
<oprypin> wmoxam, aaaany day now
<wmoxam> 🙏
<FromGitter> <GurgDev_twitter> Hey, quick question about this library request. https://github.com/crystal-community/crystal-libraries-needed/issues/1 I figured I would tackle this for fun, but noticed that even though it's the first thing requested, is a string tokenizer, and even has a ruby equivalent that's mentioned with an MIT license to copy from, that the request is still open. Has no one really done this yet?