I'm wondering about a couple factors in this comparison that seem to make a 
difference in my local test:

   1. I think perl sockets are write buffered. So would the equivalent be 
   to wrap the net.Conn in bufio.NewWriter(c) and flush before the Close?
   2. Since this is a straigh-line test where both servers are not using 
   concurrent handling of connections (uncommon for a Go server even on 1 
   core), would it not make sense to run the Go server with GOMAXPROCS=1? 

- Justin

On Saturday, June 8, 2019 at 1:36:49 AM UTC+12, Tong Sun wrote:
>
> I had always believed that the web projects build with Go should be much 
> faster than Perl, since Go is a compiled language. 
>
> However that belief was crushed brutally last night, when I did a 
> comparison -- the Go implementation is *8 times worse 
> <https://dev.to/suntong/simple-web-server-implemented-in-perl-and-go-b43>* 
> than the *Perl*! -- the *mean *response time jumped from 6ms to 48ms. 
>
> I know this is the simplest possible web server, but still, when it comes 
> to simple web servers like this, I have to say that Perl performs much 
> better than Go.
>
> I don't think there is much I can twist on the Go side, since it can't be 
> more simpler than that. However, I also believe it won't hurt to ask and 
> confirm. So,
>
> Have I missed anything? Is it possible for me to make my Go implementation 
> anywhere near the Perl's performance?
>
> Thanks
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/37a1ac7e-85ee-4775-b348-5673c41a162c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to