Yep, thanks Justin, both your points really made the difference,
because I do believe that the buffered socket write is the key
component for the 3-time improvement that I'm getting (from using
FastHTTP), IMHO. And FastHTTP recommends GOMAXPROCS=1 too, which I
used this time as well.

So thanks again, Justin & Ronny!

On Sat, Jun 8, 2019 at 10:54 PM Justin Israel <justinisr...@gmail.com> wrote:
>
> I'm wondering about a couple factors in this comparison that seem to make a 
> difference in my local test:
>
> 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?
> 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 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 a topic in the Google 
> Groups "golang-nuts" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/golang-nuts/iH2Ck_hpCpI/unsubscribe.
> To unsubscribe from this group and all its topics, 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.

-- 
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/CAMmz1OdcaBxZV2fOBu6hR1EdoE2JF8Vprgj1s9rOapAhwv8BEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to