jemc changed the topic of #ponylang to: Welcome! Please check out our Code of Conduct => https://github.com/ponylang/ponyc/blob/master/CODE_OF_CONDUCT.md | Public IRC logs are available => http://irclog.whitequark.org/ponylang | Please consider participating in our mailing lists => https://pony.groups.io/g/pony
theodus has quit [Quit: Leaving]
puzza007_ has quit [Quit: Connection closed for inactivity]
jemc has joined #ponylang
jemc has quit [Ping timeout: 248 seconds]
<endformationage> I wish to pass a Pony object to a FFI function, to be treated opaquely on the C-side, but passed to a bare lambda provided as a callback. Should this work?
<endformationage> Something along these lines: http://playground.ponylang.org/?gist=25bb5dd542ccf47d84582664046348c9
<endformationage> Hmm, I believe I have this working.
* endformationage gets it working! Yeah, woohoo!
vaninwagen has joined #ponylang
endformationage has quit [Quit: WeeChat 1.9]
phifty has joined #ponylang
<phifty> hi, I have a question regarding capabilities and HTTPHandler
<phifty> I want to save the responded headers that are supplied via the apply function of the HTTPHandler and send it - after the body has been received - to another handler
phifty has quit [Client Quit]
<vaninwagen> phifty do you have some example code to show? this would make your problem clearer and easier to help.
<vaninwagen> https://playground.ponylang.org is awesome for that
plietar has joined #ponylang
plietar has quit [Remote host closed the connection]
<doublec> phifty, if you read the logs, I think you'll have to copy the headers
<doublec> They're a ref in the Payload so you can't send them elsewhere
samuell has joined #ponylang
samuell_ has joined #ponylang
samuell has quit [Ping timeout: 246 seconds]
samuell_ has quit [Client Quit]
jemc has joined #ponylang
jemc has quit [Ping timeout: 240 seconds]
theodus has joined #ponylang
aturley has quit [*.net *.split]
achambers has quit [*.net *.split]
achamber1 has joined #ponylang
<SeanTAllen> Pony 0.18.1 has been released. Upgrading is recommended: https://www.ponylang.org/blog/2017/08/0.18.1-released/
<vaninwagen> ヽ(°◇° )ノ
_andre has joined #ponylang
<theodus> Calls to Debug are seriously reducing the performance of my programs by one or two orders of magnitude when optimized. When the calls to Debug.out are commented out everything runs much faster. Is this expected?
<theodus> I suspect that they reduce inlining, but it seems like the inlining should happen after the Debug calls are removed since it's not being compiled in debug mode.
tscho has quit [Read error: Connection reset by peer]
tscho has joined #ponylang
<SeanTAllen> well
<SeanTAllen> theodus: can you share an example of debug usage
<SeanTAllen> i see a definite problem
<SeanTAllen> well maybe a problem
<SeanTAllen> it would be interesting to look at the generated code theodus
<SeanTAllen> could you open an issue for this with generated code with and without?
<theodus> I'll see if I can get a minimal example.
endformationage has joined #ponylang
<theodus> Here is a gist, don't run it on the playground. https://gist.github.com/anonymous/949c7766327cd9423a19aa565f4ca2f7
<theodus> I'm not sure if it's exactly the same issue, but it does show that the Debug call isn't being optimized out entirely.
<theodus> And be careful, memory is consumed quickly
<theodus> when the debug call isn't commented
<SeanTAllen> have you looked at the generated code in each case?
<theodus> When uncommented, the generated llvm-ir is 22% larger and the assembly is 27% larger.
<theodus> Other than that, I'm not sure what to look for since it's all been optimized
jemc has joined #ponylang
<jemc> theodus: note that `ifdef debug` is the only construct that is eliminated at compile time when compiling in non-debug mode
<jemc> `Debug.apply` is implemented with `ifdef debug` inside it
<jemc> but the expression for the argument you pass to it will not be eliminated
<jemc> so I'm not surprised that your `"total: " + total.string()` expression is still being executed in both debug and release mode
<theodus> But Debug.out only calls _print, which is also implemented with `ifdef debug`. Shouldn't the argument then be eliminated as dead code?
<jemc> I personally don't know a lot about the LLVM IR optimizer - I'm not sure whether it can be sure that the String.add doesn't have "side effects" that have to be kept
<theodus> I see, well in that case it's not a big deal except that it makes Debug unusable if you care about performance.
<SeanTAllen> ah o missed that
<SeanTAllen> so theodus this is why the Logger works the way it does
<theodus> But I guess they could just be commented out
<SeanTAllen> or wrap it in an ifdef debug
<SeanTAllen> that is what we do with similar code in our codebase
<SeanTAllen> Benoit and Sylvan are probably best to discuss with in general for further optimization
<SeanTAllen> I think that's a good sync topic
<SeanTAllen> jemc: are you back from traveling?
<jemc> "unusable" is a bit of a strong word, though it may be unsuitable for a given purpose in a given situation - it's still quite useful if your `Debug.out` argument doesn't do any computation (like, you already have the string or stringable ready to give it)
<jemc> it may be possible that we could tweak some things to make the LLVM IR optimizer be smart enough to get rid of the "dead code" in the argument
<jemc> as SeanTAllen mentioned, it would be a good sync topic to discuss
<jemc> another option would be to have a variant of `Debug` that accepts a lambda
<jemc> and you could do your computation inside the lambda, which is never called if the `ifdef debug` branch is removed
<theodus> That is an option, but I personally prefer wrapping the call in an ifdef.
<jemc> theodus: as a workaround, I think your example would be significantly more efficient if you just didn't do the `+`, and made two `Debug` calls
<jemc> since you'd just be passing an existing string to the first call and an existing stringable to the second call, and no computation would be done when not in debug mode
vaninwagen has quit [Ping timeout: 240 seconds]
<jemc> this pattern could be interesting if combined with some operator sugar
<jemc> for example:
<jemc> Debug << "total: " << total
<jemc> C++ folks would be happy :)
<jemc> C++ haters, less so
<jemc> SeanTAllen: still traveling, but I may have some time later to do the thing you were asking me about
<jemc> s/later/later today/
Matthias247 has joined #ponylang
jemc has quit [Ping timeout: 260 seconds]
<SeanTAllen> jemc we ran into perf issues with lambdas in our "Invariant" code that is like Debug
<SeanTAllen> and had to wrap in ifdef debug
<SeanTAllen> so sync conversation is good
<SeanTAllen> o jemc: i wasnt looking to get you to do anything, was merely curious
theo has joined #ponylang
theo has quit [Quit: Bye]
Matthias247 has quit [Read error: Connection reset by peer]
<cquinn> I probably did something wrong, but I'm pretty sure I'm running the ponyc I built from master with the corresponding packages from master.
<SeanTAllen> i dont ge that
<SeanTAllen> seems like a local error for you cquinn
<SeanTAllen> or somehow environmental
theo has joined #ponylang
samuell has joined #ponylang
_andre has quit [Quit: leaving]
samuell has quit [Read error: Connection reset by peer]
theobutler has joined #ponylang
theo has quit [Ping timeout: 276 seconds]
theo has joined #ponylang
theobutler has quit [Ping timeout: 246 seconds]
Matthias247 has joined #ponylang
theo has quit [Quit: Bye]
<cquinn> yeah, it's weird. The 0.18.1 release works fine.
<cquinn> ok, something was funky in my src/ tree, but is now cleaned up and working.