Raimondi has quit [Remote host closed the connection]
Raimondii is now known as Raimondi
<FromGitter>
<jots_twitter> riffing off of @Papierkorb: https://gist.github.com/anonymous/841f7594125243f3ea8e652524d073fa ⏎ 2 things: it looks like IO is not the slowdown, it is just the comparison of the character. also, looks like reading into a buf for the final read is not right, or not null terminated or something. Is it a bug?
onionhammer has quit [Ping timeout: 245 seconds]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
<FromGitter>
<drosehn> what happens if you change `nbytes += 1` to `nbytes += c.size`
<FromGitter>
<jots_twitter> it's a UInt8. so always 1 byte
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
<FromGitter>
<drosehn> Hmm. I haven't tried to run this, but won't `buf.each` always process all 4096 bytes?
<FromGitter>
<drosehn> ... but I'm heading home. g'night for now.
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
phase_ has quit [Remote host closed the connection]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
snsei has joined #crystal-lang
onionhammer has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 260 seconds]
Philpax has quit [Ping timeout: 268 seconds]
snsei has quit [Remote host closed the connection]
pawnbox has quit [Ping timeout: 256 seconds]
pawnbox has joined #crystal-lang
bjz has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
soveran has quit [Remote host closed the connection]
bjz has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Read error: Connection reset by peer]
Guest22552 has joined #crystal-lang
mark_66 has joined #crystal-lang
snsei has joined #crystal-lang
optikfluffel has joined #crystal-lang
gloscombe has joined #crystal-lang
snsei has quit [Ping timeout: 240 seconds]
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 265 seconds]
Guest22552 is now known as soveran
soveran has joined #crystal-lang
soveran has quit [Changing host]
pawnbox has quit [Ping timeout: 248 seconds]
j2k has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 248 seconds]
pawnbox has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<FromGitter>
<luislavena> @jwoertink `Time` does not have a default serialization mechanism. There are some tickets discussing that and talking about setting an standard, but nothing solved yet.
j2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Philpax has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
x0f has quit [Ping timeout: 260 seconds]
hako has joined #crystal-lang
x0f has joined #crystal-lang
optikfluffel has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mgarciaisaia has joined #crystal-lang
hako has quit [Ping timeout: 248 seconds]
mgarciaisaia has left #crystal-lang [#crystal-lang]
matp_ has quit [Read error: Connection reset by peer]
<crystal-gh>
[crystal] asterite closed pull request #3521: Allow HTTP::Client block initializer to be used when passing an URI (master...http-client-blocks) https://git.io/vX0dm
pawnbox has joined #crystal-lang
<crystal-gh>
[crystal] asterite closed pull request #3534: Fix broken link in class.cr documentation (master...fix-broken-class-link) https://git.io/vXKZx
<coderobe>
how do i correctly turn a YAML.mapping into a string?
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: https://git.io/vXydT
<crystal-gh>
crystal/master 7e62375 Luis Lavena: Automatically unpack Tuple when sorting arrays...
pawnbox has joined #crystal-lang
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
gloscombe has quit [Ping timeout: 260 seconds]
gloscombe has joined #crystal-lang
<crystal-gh>
[crystal] asterite opened pull request #3553: Time: JSON and YAML serialization using ISO 8601. Fixes #3106 (master...feature/time_json_yaml) https://git.io/vXyFw
<coderobe>
"in /usr/lib/crystal/yaml/to_yaml.cr:12: no overload matches 'MyYamlMapping#to_yaml' with type YAML::Emitter"
<coderobe>
...
coderobe has quit [Read error: Connection reset by peer]
<FromGitter>
<overnet> what is the max posible size of some_regex ?
<FromGitter>
<luislavena> @overnet Crystal's Regex is backed by PCRE, looking for PCRE limits might be useful
<FromGitter>
<luislavena> s/looking/searching
j2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<overnet> @luislavena Thank you. But still, I found that crystal has alot lower limit than ruby
<FromGitter>
<overnet> is it posible to increase this limit in crystal?
Philpax has quit [Ping timeout: 260 seconds]
coderobe has quit [Read error: Connection reset by peer]
coderobe has joined #crystal-lang
<FromGitter>
<luislavena> @overnet if you already confirmed the limit, can you submit a ticket with the regex and the comparison against Ruby?
<FromGitter>
<luislavena> AFAIK it might require a special compilation of PCRE to increase the default limits (not sure if these can be done at runtime)
<FromGitter>
<overnet> I have tried in ruyb genarate long regex with 2607295 characters long, it works fine in ruby no errors
<FromGitter>
<overnet> and have tried in chrystal regex with 33001 characters already rises an error
<FromGitter>
<overnet> regular expression is too large at 33001 (ArgumentError) ⏎ [4560340706] *CallStack::unwind:Array(Pointer(Void)) +82 ⏎ [4560340609] *CallStack#initialize:Array(Pointer(Void)) +17 ⏎ [4560340568] *CallStack::new:CallStack +40 ⏎ [4560317593] *raise<ArgumentError>:NoReturn +25 ... [https://gitter.im/crystal-lang/crystal?at=582c70dadf5ae96645657a82]
<RX14>
i think the best answer here is *don't do that*
<FromGitter>
<overnet> @FromIRC why?
<RX14>
if you need a regex that long you're doing something wrong
<RX14>
If you have a regex that long it suggests to me you're automatically generating regular expressions, and so there's probably a bwatter way to do it
<RX14>
if it's a big "or" list then there's much more efficient matching structures
jhass has quit [Ping timeout: 246 seconds]
<RX14>
for example radix trees
<FromGitter>
<jwoertink> Thanks @luislavena and @bcardiff for the answers!
jhass has joined #crystal-lang
<coderobe>
my bouncer just died, has anyone mentioned me in the past 30 minutes or so?
<RX14>
coderobe, no
<coderobe>
k
<FromGitter>
<overnet> Yes you are right, I have to generate these regexes, but I need to combine them with regexes entered by user manualy. For example:
<FromGitter>
<maiha_twitter> Found that `FileUtils.rm_rf` exists in master branch. Can't wait 0.19.5! :)
<FromGitter>
<johnjansen> @asterite whens the next release
soveran has quit [Remote host closed the connection]
mark_66 has quit [Remote host closed the connection]
<FromGitter>
<paulcsmith> Is there a way to get the project root? That would make the request statements a bit less brittle. Right now if I do something like `require "../foo" and I move my file to a deeper folder then the require will break :(
<FromGitter>
<paulcsmith> I'm also curious how people are handling html sanitization in .ecr templates. It seems that ECR can't be extended to automatically sanitize inputs, so are people using a helper method that escapes the content? Something like Rails used to do `<%= h my_content %>`?
coderobe has quit [Ping timeout: 244 seconds]
<crystal-gh>
[crystal] asterite closed pull request #3553: Time: JSON and YAML serialization using ISO 8601. Fixes #3106 (master...feature/time_json_yaml) https://git.io/vXyFw
coderobe has joined #crystal-lang
<FromGitter>
<asterite> @johnjansen I just tried your code about counting newlines, in my case it works a bit more than twice as fast as in Ruby. How long is each line in that CSV?
<FromGitter>
<asterite> Or better, how many lines are there in that CSV file?
<FromGitter>
<johnjansen> @asterite about 1M
<FromGitter>
<asterite> I see. Yes, with longer lines and few lines Ruby is faster. I'll try to investigate why
<FromGitter>
<luislavena> @paulcsmith re: ECR, you can use `<%% %>` and `<%%= %>` to control escape. Seems is not documented but was added in pull #2004
<FromGitter>
<paulcsmith> @luislavena Sadly, it looks like that escapes the string, but doesn't do HTML escaping. Thanks for the tip though!
<FromGitter>
<luislavena> @paulcsmith I guess you will need to HTML.escape in that scenario
<FromGitter>
<paulcsmith> Ok sounds good. I'll just try to remember that :D Thanks
snsei has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has quit [Ping timeout: 246 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
<FromGitter>
<asterite> @johnjansen So, we are not using LibC's memchr, which seems to be pretty fast compared to Indexable#index. That's one optimization we can make. I'm sure there are others. It's just that Ruby has like 20 years ahead optimizing all of that C code...
sustained has joined #crystal-lang
sustained has quit [Changing host]
sustained has joined #crystal-lang
sustained has left #crystal-lang [#crystal-lang]
gloscombe has quit [Quit: Lost terminal]
<FromGitter>
<sdogruyol> @asterite which one is more effective? Struct or Hash?
<crystal-gh>
[crystal] asterite pushed 2 new commits to master: https://git.io/vXSrt
<crystal-gh>
crystal/master da1b6a0 Ary Borenszweig: YAML.mapping setter/getter generation control
<FromGitter>
<asterite> Mmm... depending for what, they are completely different things. But if you can use a struct instead of a hash, yeah, that will be much more efficient
<FromGitter>
<sdogruyol> @asterite thanks a lot for the explanation :)
<FromGitter>
<johnjansen> thanks @asterite, so whens the next release ?
<RX14>
every release I think "we're doing to have parallelism in the next release"
<RX14>
and it never happens
<RX14>
and i'm sort of glad
<RX14>
because it means I never have to think about thread-safety in my code
<BlaXpirit>
you wish..
<RX14>
i sort of feel that crystal is fast enough just to take the nodejs route and tell people to cluster processes across cores
<BlaXpirit>
the thread safety requirements are still there, but weaker, meaning you're more likely to forget about them
<RX14>
well
<BlaXpirit>
nodejs has a proper concurrency model that indeed does not require thread safety
<RX14>
the thing is that memory operations will always be single-threaded
<RX14>
you have to think about memory safety but if your method never does IO then you can act like it's in a mutex
<RX14>
which is pretty nice
pawnbox has quit [Ping timeout: 246 seconds]
j2k_ has joined #crystal-lang
j2k has quit [Ping timeout: 244 seconds]
j2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Papierkorb>
Would anybody mind if I'd contribute Enumerable#find_index?
<Papierkorb>
RX14: Like #find, but returns the index of the element instead of the element itself
<RX14>
isn't that just #index ?
<Papierkorb>
find_index is basically == enum.index(enum.find{ .. })
<RX14>
no index with block
<Papierkorb>
Ah now I see
<Papierkorb>
Did not expect a block version
<Papierkorb>
And/or, expected it to be called #find_index
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 265 seconds]
<Papierkorb>
Weird that I have such issues finding it in the docs alone. never had that many issues with rubys doc. and there's nothing wrong with the crystal docs for these methods. Dunno why.
<FromGitter>
<overnet> @<RX14>are you Zoro? Why are you hiding your name? Did you ever try to parse to parse the large regex and split it on the smaller ones without changing a meaning of original one? By your answers and sugestions I found out that crystal is a nice and powerful language with a huge limitation. Thank you every one for the help!
<FromGitter>
<drosehn> FWIW, splitting up regex's often makes sense, and can help both readability and performance. Sometimes I'll match the first part of a string, and then save away the rest of the string using `rem = $~.post_match`, and then process that.
<FromGitter>
<drosehn> Sometimes it's the *middle* of the string which is very unambiguous, and thus the easiest and cheapest to match. So then I'd save `lhs = $~.prematch ; rhs = $~.post_match`, and process those parts separately.
<FromGitter>
<drosehn> Maybe I should say "distinctive" instead of "unambiguous".
j2k has joined #crystal-lang
soveran has quit [Remote host closed the connection]
gewo has quit [Ping timeout: 252 seconds]
j2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]