A
A
andreys752021-06-21 15:10:28
JSON
andreys75, 2021-06-21 15:10:28

Why is JSON parsing speed slower on the server than in the browser?

Hello!
I need to upload files to JSON and
parse from JS code. I'm testing several options:
1 using browser workers (without using CacheAPI) all file requests are made via HTTP but everything is on the local dev computer
2 I'm using nodeJS workers. Nodejs launched microservices that process requests. JSON files are read from local disk

in both cases using JSON.parse(data)

let pStart = performance.now();
 let res = JSON.parse(data);
let pEnd = performance.now();
BundlePerformance.add({ 'String parsing': pEnd - pStart });

the problem is that the code running as backend on Node runs 5 times slower!!!!

Why is this happening? did multiple tests on the same data

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2021-06-21
@Sanasol

The code does not help to understand at least something.
How do you download, from where, what.
Here is a server load, everything works instantly on some server in a sandbox with a file of ~ 30mb.
Everything else depends on the environment, Internet speed, etc.
https://codesandbox.io/s/node-js-forked-c77nk?file...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question