Re: [go-nuts] How To Reduce Json Marshalling Time

2024-03-10 Thread Robert Engels
Apologies.On Mar 9, 2024, at 1:16 PM, Ian Lance Taylor wrote:This thread has gotten heated.  I think it's time to move on to different topics and give this discussion a rest.  Thanks.Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] How To Reduce Json Marshalling Time

2024-03-09 Thread Ian Lance Taylor
This thread has gotten heated. I think it's time to move on to different topics and give this discussion a rest. Thanks. Ian -- 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,

Re: [go-nuts] How To Reduce Json Marshalling Time

2024-03-09 Thread Mike Schinkel
On Saturday, March 9, 2024 at 10:16:12 AM UTC-5 Robert Engels wrote: When I went to the github site the OP linked it seemed to me the original question was not genuine and ... Since the OP of this thread did not link anything, I assume you by "OP" you are referring to my comments on the

Re: [go-nuts] How To Reduce Json Marshalling Time

2024-03-09 Thread 'Brian Candler' via golang-nuts
Perhaps it would be helpful to give some concrete figures for the real-world application. "the response time of Go API is higher than PHP" - how much? Are we talking, say, 1.2ms versus 1ms? Or 10ms versus 1ms? Is this testing between a client and server adjacent on the same LAN, or is the

Re: [go-nuts] How To Reduce Json Marshalling Time

2024-03-08 Thread Mike Schinkel
On Saturday, March 9, 2024 at 12:16:51 AM UTC-5 Robert Engels wrote: My guess is that most applications are decoding 25gb json files with any regularity. Even transferring 25 GB over the fastest of networks takes 20 secs? So that reduces the cost to less than 10%??? How about rather than

Re: [go-nuts] How To Reduce Json Marshalling Time

2024-03-08 Thread Robert Engels
My guess is that most applications are decoding 25gb json files with any regularity. Even transferring 25 GB over the fastest of networks takes 20 secs? So that reduces the cost to less than 10%???The test isn’t doing anything with the decoded json - maybe Go is 1000% faster in that. This is

Re: [go-nuts] How To Reduce Json Marshalling Time

2024-03-08 Thread Mike Schinkel
Hi Robert, Thanks for the reply. I decided to run a quick benchmark so I compared Go 1.22's *json.UnMarshal(any)* using an *any* type with PHP 8.3.2's *json_decode()* and found that PHP's option is 85% faster for a ~25Mb JSON file. Optimizing it with a *struct* I was able to get Go down to

Re: [go-nuts] How To Reduce Json Marshalling Time

2024-03-08 Thread Robert Engels
Related, 30k of anything is largely meaningless for modern hardware in terms of cpu processing - where billions of operations a second is the norm. On Mar 8, 2024, at 8:55 PM, Robert Engels wrote:The point I was trying to make - maybe unclear - is that it is doubtful any raw performance

Re: [go-nuts] How To Reduce Json Marshalling Time

2024-03-08 Thread Robert Engels
The point I was trying to make - maybe unclear - is that it is doubtful any raw performance differences between PHP and Go in terms of json encoding/decoding would be noticeable- unless it was a hft/hpc system which would be doubtful given that the original system was PHP. So if there is

Re: [go-nuts] How To Reduce Json Marshalling Time

2024-03-08 Thread Mike Schinkel
Hi Robert, I am now confused. While your original reply to this thread made perfect sense to me, your follow up for the purposes of clarification had the opposite effect, at least for me. I am not clear the point you are trying to make. You mention the difference between compiled and

Re: [go-nuts] How To Reduce Json Marshalling Time

2024-03-08 Thread Robert Engels
Just to be clear for others - from a raw cpu performance perspective when looking at a typical application in whole - there is very little performance difference between compiled and even GC platforms- interpreted can lag behind a bit - but in almost all cases over the web it is IO

Re: [go-nuts] How To Reduce Json Marshalling Time

2024-03-08 Thread Mike Schinkel
Hi Pragya, While Robert Engles is probably correct in identifying your bottleneck, if it does turn out to be slow JSON parsing here are a few things you can look at . 1. You mention you have to use a map because of response keys not

Re: [go-nuts] How To Reduce Json Marshalling Time

2024-03-08 Thread Robert Engels
It is highly unlikely that the Go marshaling is the cause. I’m guessing you are probably not using a buffered output stream. PHP is written in C but depending on what you are doing it is either a script or calling out to another process (afaik) On Mar 8, 2024, at 2:35 PM, pragya singh

[go-nuts] How To Reduce Json Marshalling Time

2024-03-08 Thread pragya singh
Hi, "I am facing an issue in my Go code. I converted my read API from PHP to Go, but the response time of Go API is higher than PHP. We are returning the response in JSON format, and the response contains around 30k keys, which is taking too much time in JSON marshaling. We are adding all the