IjzerenHein / kiwi.js

Fast TypeScript implementation of the Cassowary constraint solving algorithm 🖖
Other
249 stars 24 forks source link

Removed 'compare' functions and other unnecessary bits #10

Closed joshuahhh closed 5 years ago

joshuahhh commented 5 years ago

Per #9. Thanks!

IjzerenHein commented 5 years ago

Awesome, I will review and test this shortly! Thanks for the contribution!

adamhaile commented 5 years ago

Hey, I'm the guy who pushed #8 and made that code obsolete. Yeah, this totally makes sense. My initial push intentionally didn't change any code beyond maptype.ts -- I was changing enough in @IjzerenHein 's code already so preserved the code that called into createMap(). Since that change has been accepted, this cleanup makes perfect sense. :+1:

The old map used an associative array internally, and the supplied compare function was used to sort items such that lookups were O(log N). The new one uses a non-sorted array and an index map for O(1) lookups. compare therefore isn't needed.

joshuahhh commented 5 years ago

Thanks for taking a look, @adamhaile! (And for #8 too.)

joshuahhh commented 5 years ago

How do you think this looks, @IjzerenHein?