basis-company / tarantool-admin

MIT License
110 stars 28 forks source link

Simplify Select::run() #59

Closed rybakit closed 3 years ago

rybakit commented 3 years ago

is_object(), get_class() and is_subclass_of() seem to be redundant and can be replaced with instanceof.

Also, I'm confused by the line

 $value > 2 ^ 32 - 1

where 2 ^ 32 - 1 is evaluated to 29 (because ^ is a bitwise XOR operator). Was it meant to be 2 ** 32 - 1? If so, is it a sort of integer overflow detection or is there another cause (FTR, rybakit/msgpack converts overflowed integers to strings by default)?

nekufa commented 3 years ago

@rybakit yep, you are right, thanks!

rybakit commented 3 years ago

Hey @nekufa, you are welcome :) By the way, if you want to make things a bit faster, you can move this casting to the msgpack transformer (one or several) and drop these loops entirely, it will reduce the time complexity from O(n^2) to O(1).

nekufa commented 3 years ago

@rybakit interesting, thanks!