is callsub add a lot of overhead?

melamoud

Active Member
Licensed User
Longtime User
I'm trying to make a generic sorting algorithm , and i need a compare callback method, my quicksort without the call for the compare takes 3 ms with it it take 150ms is that make sense ?
my compareValue sub is as simple as it can be (compare two int) but I do cast it from object to int - maybe that add something

anyone ?
 

melamoud

Active Member
Licensed User
Longtime User
here it is,

to see the callback overhead press quick sort and quicksortCB (you need to randomize in between)
to see the stackoverflow press same value and quicksort

the code is a mess (just testing code) sorry about that
 

Attachments

  • Sorting.zip
    331.9 KB · Views: 153
Upvote 0

melamoud

Active Member
Licensed User
Longtime User
I was trying (for fun not really need it) to generalize the sorting algorithm, basically have the developer build a list or array of objects and only he knows how to compare the values, this can not be done without call sub right ?
(until b4a will support more OOP attributes)
 
Upvote 0
Top