L
L
lukoie2018-06-07 19:25:56
PHP
lukoie, 2018-06-07 19:25:56

Will Go give advantages in such a project?

There is such a project:
0 times a day we ping the Jason on the page where the database is laid out
1 if the data regarding the previous request has been updated in the Jason (there is a date field) - we download the zip archive (~ 300Mb) from the Jason link (~ 300Mb)
2 there are 2 xml files in the archive , we only need one (~1GB). We parse it into our SQL
3. It contains a list of companies, with a bunch of fields for each. Time 2 or 4 in a month new firms are added to this xml. We need to take a sample of only a few types of activities, there will be about 5 conditions. We write this data in MySQL.
Now this is implemented in php by xmlreader.
So, the question is, if all or only part of these tasks are converted to Go, will it give any advantages enough to make it worth doing it?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
R
Roman Kitaev, 2018-06-07
@deliro

Of course not. Most of the time your script will download, unzip and wait for the database.

L
latteo, 2018-06-08
@latteo

Depends on the level of the programmer and code optimization in PHP and Go.
For example: I have been working with php for a long time and for one long-running task, I quickly read the mana, sketched out a code in Go, the code worked out in the same time as php 5.6 and 30% slower than php 7.1
Surprised by these results, I spent half a day googling and experiments with Go, found out where the jamb was (the specifics of using variables in Go) and achieved the result a little faster than php 7.1 :)
The experience turned out to be useful for self-education, but not for optimization.
With xml\html parsing, things are much more ambiguous. On Habré, once upon a time there was an article, there, depending on the language and the specific library within one PL, the execution speed differed dozens of times. Here, without experiment, pure fortune-telling comes out.

T
ThunderCat, 2018-06-07
@ThunderCat

what actions do you want to speed up? The software part performs the only difficult task - it parses the xml, everything else is the work of the database and the file system, as Roman Kitaev wrote , if the part working with the xml parsing does not suit the speed - rewrite the parsing to go, IMHO there will be no increase at times, but you will raise 30 percent .

B
beduin01, 2018-06-08
@beduin01

No, throw out Go. This is not a language, but a misunderstanding. Write in Python or your favorite PHP. You can look at D. There, this task is 2 times easier/shorter than in Go.

A
Alexander Kubintsev, 2018-06-08
@akubintsev

Go for parsing can be very inconvenient.
If you can somehow parallelize parsing across goroutines, then you should ask yourself the question, is it possible to do something similar in puff? Perhaps it will be possible to write and support faster.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question