Comments (4)
The class instance can be passed instead of the class name (like 'connectionStrategy' => new \Manticoresearch\Connection\Strategy\StaticRoundRobin()
).
Removing the class_exists or disabling the autoload I don't think are good ideas. Instead at
it might make sense to test if the class name starts with
Manticoresearch\
(like 0 === strncmp($className, 'Manticoresearch\\', 16)
)from manticoresearch-php.
➤ Nick Sergeev commented:
I've run both variants, but actually haven't observed a noticeable difference in performance.
Here is my test script test_time.php
<?php
require_once __DIR__ . '/vendor/autoload.php';
$config_connections = [
[
'host' => 'localhost',
'port' => '9308',
],
];
$client = new \Manticoresearch\Client([
'connections' => $config_connections,
'connectionStrategy' => 'StaticRoundRobin', // variant 1
//'connectionStrategy' => \Manticoresearch\Connection\Strategy\StaticRoundRobin::class, // variant 2
'retries' => 3
]);
?>
And here is an example of the performance times obtained with time php test_time.php
for the variants 1 and 2, respectively:
real 0m0,042s
user 0m0,031s
sys 0m0,009s
and
real 0m0,042s
user 0m0,025s
sys 0m0,009s
from manticoresearch-php.
The difference cannot be noticed with very few php classes in a project, but when you have thousands of classes it is noticeable. It rebuilds autoload for all classes in a project.
from manticoresearch-php.
➤ Nick Sergeev commented:
Ok, as it was proposed above, we updated the client to skip the class_exists
check if the path to a strategy class starts with Manticoresearch\
from manticoresearch-php.
Related Issues (20)
- PHP Code Style HOT 8
- PhpHttp transport depends on not existing package HOT 2
- In Manticore Search 6.2.12 version some forbidden chars breaks request even after escaping... HOT 1
- Drop support for older versions of php HOT 7
- The first request is not search request if using basic auth HOT 8
- Discussions for Q&A HOT 1
- Document ID started from huge number HOT 1
- getDocumentByIds doees not work: "self" in callables is deprecated HOT 3
- ResponseException with message ""\"in\" filter should contain an array of values for not sequencial ids HOT 1
- `getDocumentByIds` returns not all documents when size of array > 20 HOT 3
- Correct pagination HOT 1
- It doesn't throw ResponseException on response error HOT 1
- Add support of method chaining for knn HOT 4
- Float encoding problem HOT 2
- KNN overwrite the query while it's not expected HOT 2
- NICK will remove https://github.com/manticoresoftware/manticoresearch-php/blob/master/CHANGELOG.md HOT 1
- NICK will fix the example related with "new Match" HOT 1
- Composite aggregation HOT 1
- Implement partial replace HOT 1
- Invalid HTTP request in some cases on replaceDocuments HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from manticoresearch-php.