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
hobomatic has joined #ponylang
<hobomatic> is there a general way to pass flags to the linker from ponyc, or should I instead just do linking seperately if i need to pass custom flags?
muhajir has joined #ponylang
<muhajir> Hi everyone
<hobomatic> hello
<muhajir> Ah, I thought nobody is online. I just found pony lang yesterday. And it seems really fun. So what's reason making pony object oriented, well you know some other lang like rust and golang not going to object oriented, I know that oo in pony does favor composition rather than inheritance. Note that I am against object oriented and not golang nor rust developer. I just want to know why?
<muhajir> I am sorry , I mean : * I am not against Object Oriented
endformationage has joined #ponylang
<hobomatic> the way in which pony is object oriented isn't really that far off from how go and rust are object oriented
<hobomatic> and they are all object oriented (loosely speaking)
<hobomatic> i guess that doesn't actually answer you question, but i don't actually know why, just how its concept of OOP relates to other things
<muhajir> Ah, I thought they're far. Thanks for the answer brother. I'll explore more on pony.
<muhajir> And btw, what is the state of pony for web development right now?
<hobomatic> I don't know much of anything about the library ecosystem, but there are packages in the standard library related to HTTP and TLS. As far as frontend goes, I am not sure there is much of anything at all
<hobomatic> you should stick around and wait for better answers from more experienced people, but i figure I can give some vague probably wrong answers in the mean time
<hobomatic> IRT the way that pony is object oriented, one important aspect is that classes don't fill the role of supertypes at all. Compared to rust, for instance, classes are more like Impl's than Traits
<hobomatic> and then you have traits and interfaces to act as supertypes
<hobomatic> traits are sort interfaces and abstract classes in most languages, and interfaces are like golang interfaces, not requiring subtypes to declare that they implement them
<muhajir> Hmm, many thanks for exploring the topic
tscho_ has quit [Read error: Connection reset by peer]
tscho has joined #ponylang
<hobomatic> my impression of the over-all direction that the language is going is that its trying to be a language for writing distributed systems, but along the way it has stopped to get local concurrency right
<hobomatic> so, more like erlang with a strong static type system and native code generation, rather than something like rust or golang
<muhajir> I've tried elixir few weeks ago, and I like it. And was looking for static & native lang too. So when saw pony, It really "clicks" haha
codenoid has joined #ponylang
<hobomatic> I just like good type systems, and languages that prioritize being able to isolate some part of your code from certain resources (so that you can use untrusted code)
<codenoid> Hi, how I can print an array
<muhajir> Hello Mr. rubi.
<codenoid> hei,
<codenoid> I still can't find the method to print an array,
<hobomatic> i don't think there is one. It does not implement stringable
codenoid has quit [Quit: This computer has gone to sleep]
codenoid has joined #ponylang
codenoid has quit [Client Quit]
codenoid has joined #ponylang
<codenoid> Oh, ok
jemc has quit [Ping timeout: 255 seconds]
codenoid has quit [Quit: This computer has gone to sleep]
codenoid has joined #ponylang
codenoid has quit [Client Quit]
codenoid has joined #ponylang
jemc has joined #ponylang
muhajir has quit [Ping timeout: 260 seconds]
<hobomatic> hmm, I am guessing the reason there is no string() method for Array (or Seq or List) is that there is no good way to put a constraint on a type variable in the receiver's type expression
<hobomatic> and if there is a way, its not at all obvious to me
<hobomatic> well never mind
<hobomatic> thats not right
<hobomatic> nope, can't just reuse the type variable in the method's type arguments
ShalokShalom has joined #ponylang
codenoid has quit [Quit: This computer has gone to sleep]
codenoid has joined #ponylang
jemc has quit [Ping timeout: 240 seconds]
_whitelogger has joined #ponylang
hobomatic has quit [Quit: Leaving]
muhajir has joined #ponylang
muhajir has quit [Quit: Page closed]
_whitelogger has joined #ponylang
codenoid has quit [Quit: This computer has gone to sleep]
endformationage has quit [Quit: WeeChat 1.9]
user10032 has joined #ponylang
codenoid has joined #ponylang
codenoid has quit [Quit: Leaving]
ShalokShalom_ has joined #ponylang
ShalokShalom has quit [Ping timeout: 252 seconds]
ShalokShalom_ is now known as ShalokShalom
<SeanTAllen> hobomatic: because the items in a list or an array might not be Stringable. You can write your own utility primitive that takes an Array[Stringable] and then does the printing.
<SeanTAllen> hobomatic: --help will show you all the ponyc options including --linker
<SeanTAllen> muhajir: what is it you were interesting in knowing about OO and Pony?
<SeanTAllen> codenoid: you cant print an array because the items in an Array might not be Stringable. You can write your own utility primitive that takes an Array[Stringable] and then does printing.
acarrico has joined #ponylang
user10032 has quit [Remote host closed the connection]
acarrico has quit [Ping timeout: 240 seconds]
acarrico has joined #ponylang
shankwirt has joined #ponylang
shankwirt has quit [Client Quit]
jemc has joined #ponylang
jemc has quit [Client Quit]
jemc has joined #ponylang
acarrico has quit [Ping timeout: 248 seconds]
BUD1 has joined #ponylang
<BUD1> Hi Good evening
ShalokShalom has quit [Read error: Connection reset by peer]
ShalokShalom has joined #ponylang
<BUD1> Just tried http server from https://github.com/ponylang/ponyc/blob/master/examples/httpserver/httpserver.pony and do some local "hello world" benchmark test.
<BUD1> Activity monitor show 4 threads but i got middle performance compared to another language (Crystal)
<BUD1> which use only single core
<SeanTAllen> BUD1 that http server was not written with performance in mind, merely to be able to do basic http serving
<SeanTAllen> There are numerous performance issues with it
<SeanTAllen> I'd also point out that 4 threads is far from guaranteed to get better performance than 1. Depending on workload, 1 cpu/thread will often out-perform 4. That said, the http server was not written with performance in mind.
<SeanTAllen> I pointed to specific issues in this email thread: https://pony.groups.io/g/user/topic/pony_did_poorly_in_a_recent/5411536?p=,,,20,0,0,0::recentpostdate%2Fsticky,,,20,2,40,5411536
<SeanTAllen> You can read more about writing high-performance Pony code here: https://www.ponylang.org/reference/pony-performance-cheatsheet/
<SeanTAllen> Lastly, setting up benchmarks to get "accurate" results can be notoriously hard. Especially if you don't really understand the system under test and how it utilizes resources.
<SeanTAllen> But again, in this case, I would go back to "the Pony http server in the standard library wasnt written with performance" in mind.
<SeanTAllen> If you or anyone else is interested in writing a high-performance http server in Pony, I'd be happy to help guide efforts. One of the reasons I wrote the Pony performance cheatsheet was so that others could assist in writing high-performance Pony libraries including things like HTTP parsers and what not.
endformationage has joined #ponylang
<BUD1> I'm still new to pony and need a lot of experiences.
<BUD1> Doing Performance stuff is not on my task at the moment.
<BUD1> Thank you for pointing the issue
<SeanTAllen> Quite reasonable BUD1. I'm here in general to help with things.
<BUD1> I'm curious about "4 threads is far from guaranteed to get better performance than 1", can you please explain?
<SeanTAllen> if you have enough work to max out 1 thread, but not more than that
<SeanTAllen> then the overhead of sharing work between multiple threads is going out weigh the non-existent benefit you are getting from having more than 1 thread
<SeanTAllen> to use an analogy. imagine for a moment that there is 8 hours of work to do. you can either do it by yourself in 8 hours or you can split it with another person but while you are splitting it, you have to constantly communicate about who should do what. odds are, having that extra person to "help" is going to slow things down
<SeanTAllen> going back to computers for a moment, using more than 1 cpu, depending on the job, you could end up ruining per cpu caching, introduce context switching and what not.
<SeanTAllen> Pony scheduler threads by default run as 1 per cpu
<SeanTAllen> So, in theory, anything that stays on the same scheduler is going possibly benefit from cache advantages.
<SeanTAllen> Imagine if you will, 2 actors that send messages back and forth.
<SeanTAllen> Actor A send message 1 to Actor B who sends reply 1 back to Actor A
<SeanTAllen> if this is all done with 1 scheduler, that is 1 thread, then when Actor A send message 1 to actor B, the CPU running the scheduler should already have message 1 cached when actor B goes to retrieve it.
<SeanTAllen> This is going to be faster than if Actor A is one on scheduler thread (and CPU) and Actor B is on another.
<SeanTAllen> "CPU caches" are huge for providing improved performance
<SeanTAllen> Are you familiar with the various CPU caches BUD1?
<SeanTAllen> I'm going to post a couple resources:
Matthias247 has joined #ponylang
<SeanTAllen> There's a ton more stuff out there, but, I'm going to stop there.
Praetonus has joined #ponylang
<SeanTAllen> My point with all of this is merely to support the statement that more threads, more concurrency, more parallelism, doesn't automatically mean better performance. It can often hurt performance.
<SeanTAllen> This is all very handwave-y because we aren't even talking about a specific program or a part of a program. For example, how does Crystal do scheduling? How does Pony do scheduling? Does having more threads than required for the workload add overhead? How much?
<SeanTAllen> Performance can be very complicated and benchmarking is wicked hard.
<SeanTAllen> Sadly most benchmarks are worthless or presented as proving something they don't.
<SeanTAllen> That was a lot of information to dump on your BUD1. Hopefully it was helpful.
<BUD1> What an explanation. Thank you.
<BUD1> In context of http server, will it make different when it run multiple process rather than multiple thread/parallelism?
<SeanTAllen> You're welcome.
<BUD1> for example running http server 4 times and reuse the http port
<SeanTAllen> at the least, that would depend on the workload
<SeanTAllen> but i dont have an answer for you, its something that would need to be tested.
<SeanTAllen> how you share the port amongst processes is going to have a large impact.
<SeanTAllen> my suspicion based on http servers in general is that multiple threads will do better than multiple processes.
<SeanTAllen> but at this point its pure intution and there's a ton of details that arent covered in the question that could have a large impact.
<SeanTAllen> i've never reused addresses across TCP listeners and measured what the performance implications are.
<SeanTAllen> that would vary across TCP implementations
<SeanTAllen> but going back to the initial point, if there is only enough work to power that one CPU, then adding more parallelism is probably going to hurt, rather than help performance.
<SeanTAllen> actually that is wrong, what i said, adding more parallelism might hurt.
<SeanTAllen> it really depends on the workload, the application and a ton of other factors. the only way to find out is to devise good benchmarks and then you will know for a specific workload, run in a specific way in a specific environment what the impact is.
<BUD1> "if there is only enough work to power that one CPU, then adding more parallelism is probably going to hurt, rather than help performance." i should remember this :)
<SeanTAllen> i overstated that initially
<SeanTAllen> it really depends on the workload
<SeanTAllen> however, people often see more parallelism as always good, which is not true.
<SeanTAllen> also people have varying definitions of parallelism and concurrency so, i should probably be more precise with my terms.
BUD1 has quit [Ping timeout: 260 seconds]
BUD_1 has joined #ponylang
<BUD_1> Sorry, connection problem
<SeanTAllen> welcome back BUD_1
<SeanTAllen> if you missed anything, you can check the IRC logs: http://irclog.whitequark.org/ponylang
<BUD_1> Yes, i already checked. Does not miss so much :)
<BUD_1> Now i'm wondering how pony distribute actors to schedulers, will it push all to one CPU core first?
<BUD_1> To get benefit of the cache?
<SeanTAllen> The rules are currently very straightforward
<SeanTAllen> Lets assume just two actors for a minute
<SeanTAllen> When actor A sends a message to actor B one of two things will happen
<SeanTAllen> If actor B is currently scheduled to run on a scheduler, it will stay with that scheduler
<SeanTAllen> If actor B is unscheduled, it will be scheduled to be run by the same scheduler that is running Actor A
<SeanTAllen> which could possibly get cache benefits
<SeanTAllen> Then there is work stealing
<SeanTAllen> a scheduler that has no actors to run will attempt to steal actors from other schedulers
<SeanTAllen> the code for how work stealing current works starts around here: https://github.com/ponylang/ponyc/blob/master/src/libponyrt/sched/scheduler.c#L231
<BUD_1> When a scheduler steal from another schedule, let says actor C. This will still possible to hurt performance when C call actor D? Or D also get stolen with C?
<SeanTAllen> only a single actor is stolen at a time
<SeanTAllen> they aren't stolen as groups
BUD_1 has quit [Ping timeout: 260 seconds]
user10032 has joined #ponylang
plietar_ has joined #ponylang
plietar_ has quit [Client Quit]
Matthias247 has quit [Read error: Connection reset by peer]
ShalokShalom is now known as haywire
haywire is now known as heywire
user10032 has quit [Quit: Leaving]
heywire is now known as ShalokShalom