No, I made a mistake and thought that he was there.
Actually I'm surprised about the go, "I thought to be much better than all" (c).
And at the same time advise on what spamilku write. The task - just send 1 post request and parse the response. Now I send via php-curl, ceto is already at 5k flows eats percent and memory (I generally every request - 1 process php-cli, know what's funny). I wrote above that are not a programmer, I think that's something to read, but do not know that :) node or the second?
I can certainly nakostylit something in php to guzzle, but it is interesting to listen to your advice.
А тебе не сложно сейчас взять re2 для твоего go кода и проверить еще раз? Я прост смотрю и не вижу особой разницы в скорости с pcre :)
And you do not take re2 difficult now to go your code, and check again? I just look at it and do not see much of a difference in speed with pcre :)
Потому что надо брать не простую строку в 50 символов, а что-то большее;
дальше стер, потому что я не программист и спорить лень. ---------- Добавлено 15.06.2020 в 21:51 ----------
Тут не в сотый, а на условном SO в сотый. Высосали задачу из пальца и пишете новое решение, хотя все давно написано и либы давно есть.
Если уж совсем прямо, то у sly32 бомбануло от уровня этого раздела форума (что логично, учитывая двух долбоебов sevlad и sitealert) и он решил начать меряться кодом. Но я думаю (да вы и сами знаете), что это не тот форум для такого уровня.
Because it is necessary to take not a single line of 50 characters, and something more;
further erased, because I am not a programmer and argue laziness. ---------- Posted 15.06.2020 at 21:51 ----------
It's not the hundredth, and conditional SO hundredth. Sucked from the finger task and write a new solution, but all have been written for a long time there, and libs.
If we are really straight, then sly32 bombanulo the level of this forum section (which is logical, given the two dunce sevlad and sitealert) and he decided to start code to be measured. But I think (yes you and know) that this is not the forum for such a level.
danforth, не совсем согласен с бенчмарками, но спасибо за объяснение. Вообще я не поклонник таких тредов тут, это показательное решение синтетических задач которое в реальности работает иначе.
Ну и зачем вы в сотый раз меряетесь потоковым парсером json, тоже не понимаю.
Danforth, not quite agree with the benchmarks, but thanks for the explanation. Generally I'm not a fan of these threads of here, this is indicative of synthetic solution of problems which, in reality, works differently.
Well, why are you for the hundredth time to measure a streaming parser json, I do not understand.
Если что, я не докапываюсь, но это как? Точнее, какие библиотеки сравнивались? Не верю :)
В php видимо PCRE (или PCRE2?), а в go?
If I do not get to the bottom, but it's like? More precisely, what compared libraries? I do not believe :)
In php apparently PCRE (or PCRE2?), And go?
Смотри, сейчас взял с рабочего постера по xmlrpc, добавил твоё кастом поле:
<?xml version="1.0"?> <methodCall> <methodName>metaWeblog.newPost</methodName> <params> <param><value><array><data> <value><int>0</int></value> <value><string>admin</string></value> <value><string>passwd</string></value> <value><struct> <member><name>title</name><value><string>hello world title2</string></value></member> <member><name>description</name><value><string>hello world body2</string></value></member> <member><name>dateCreated</name><value><dateTime.iso8601>20200615T14:18:04</dateTime.iso8601></value></member> <member><name>mt_allow_comments</name><value><int>0</int></value></member> <member><name>mt_allow_pings</name><value><int>0</int></value></member> <member><name>post_type</name><value><string>post</string></value></member> <member><name>custom_fields</name><value><array><data> <value><struct> <member><name>key</name><value><string>thumbnail_external</string></value></member> <member><name>value</name><value><string>https://my_site/image.jpg</string></value></member> </struct></value> </data></array></value></member> </struct></value> <value><boolean>1</boolean></value> </data></array></value></param> </params></methodCall>
Формируется так:
$date = new IXR_Date(time()); $postData = [ 'title' => 'hello world title2', 'description' => 'hello world body2', 'dateCreated' => $date, 'mt_allow_comments' => 0, 'mt_allow_pings' => 0, 'post_type' => 'post', 'custom_fields' => [ [ 'key' => 'thumbnail_external', 'value' => 'https://my_site/image.jpg', ] ] ]; $client = new WP_HTTP_IXR_CLIENT( $url); $client->debug = false; if (!$client->query('metaWeblog.newPost', array(0, $login, $passwd, $postData, true))) { echo "err: " . $client->getErrorMessage() . "\t"; return null; }
Если вдруг хочется делать именно так (непонятно, зачем), можно через wp-cli еще: