-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add STL-like structures without using void pointer. #1815
Comments
Which data structures are you missing? |
List, arrayList, linkedList, vector, queue and function for it, way for create abstract structures and function with T parameter, and function without void pointer its main goal for it feature because it is make sort more slower. |
what's the difference between list, arraylist, and vector? V already has dynamic arrays: |
@medvednikov I think he is comparing it with Java. This can help in comparing them and List is just an interface and its already implemented as arrays. |
@Omnuchka Its hasn't been done yet because V partially support Generics and all containers will hopefully be implemented by it soon. |
V won't need separate synchronized types, besides Java's vector seems to be deprecated: https://stackoverflow.com/questions/1386275/why-is-java-vector-and-stack-class-considered-obsolete-or-deprecated Linked lists should never be used: https://www.youtube.com/watch?v=YQs6IC-vgmo Even if you do want to use one, it's very trivial to implement it yourself. The upcoming channels can be used as threadsafe queues. So no extra data structures need to be implemented. |
Sort for dynamic arrays exist? Used void* pointer or not? |
yes, there's array.sort() arrays are implemented with void* |
yes, in this feature i want say, please change it because it is not the best way. It is easy but bad for performance, standard algorithm for it without pointer more effective. |
if you use void* for pointer on any type and it give you way for sort any data(T) it is not good |
@Omnuchka I benchmarked a 10 million vector in C++/Go/V, and V is 50 % faster than C++ and 200% faster than Go. So it's good enough. |
V must have the best sort algorithm, not only good, sort must be a best sort! |
A balanced binary tree is needed for when you need to iterate in sorted order and insert items quickly too. V's map should use a hash table for fastest lookup, maps don't need to iterate in sorted order. (If map stays as a tree then we need a library hash table). |
I wouldn't fully agree with blindly using the fastest hash table. If hash table, then with randomization and with guaranteed predictable linearly scaling behavior disallowing dangerous attack vectors. So the current implementation is actually not that bad (the speed can be even further improved by making it more cache friendly at the expense of lost ordering which would be unfortunate though). Btw. recent thorough test of hash maps was performed by Martin Ankerl - see https://martin.ankerl.com/2019/04/01/hashmap-benchmarks-01-overview/ and the corresponding github repository (to run the tests on your own HW to verify). |
I just meant that a hash table is faster than a binary tree, O(k) vs O(log n).
Has it changed recently? Last time I looked it was an unbalanced binary tree. |
A void pointer can take up a lot of memory and processor takts if the processor is processing large amounts of data. If patterns generation already exist can you add library with basic data structures, pls.
The text was updated successfully, but these errors were encountered: