Replies: 1 comment 2 replies
-
@rkompass When you say that fast sorting of float arrays in not possible in |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to share that I found out that in Viper code I may compare / sort float values easily.
This is due to the IEEE-754 standard.
Three functions illustrate this:
This was used in a quicksort function which sorts an
array.array('f',...)
(which I may share too upon request).The true speed gain but resulted from inlining
for greater than or equal, and
for equal, with x and y delared as int, thus ignoring the equality of +0.0 and -0.0 (which sorts good anyway).
This makes a very fast sorting of float arrays possible, which we do not have as function in MP (not in ulab either).
The above inlining is necessary due to the fact that just a call to another viper function carries the costs of all python handling overhead (3-5 us). Including the above comparisons as function makes the >10 x speed gain vanish.
So dreaming about a way to call a viper function like a C-call without overhead . . . would allow for viper functions for add, subtract, multiply of floats?
Beta Was this translation helpful? Give feedback.
All reactions