Тёмный

Python tops the podium against Rust, Julia, and Mojo when calculating lexical diversity (MATTR) 

EKB PhD
Подписаться 488
Просмотров 380
50% 1

Опубликовано:

 

27 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 11   
@TheBIMCoordinator
@TheBIMCoordinator 24 дня назад
I really enjoy this channel! I have been picking up rust from python trying to solve bottlenecks from speed
@ekbphd3200
@ekbphd3200 23 дня назад
I’m so glad!
@pyajudeme9245
@pyajudeme9245 Месяц назад
Great video, I like your benchmark videos, but from Rust's perspective it's a little unfair. It's not representative when Rust is a slave of Python's GIL. However, I think the speed difference between the language is not that big, because UTF-8 chars don't have a fixed byte size. It would be nice to see a comparison between utf-8 and byte strings (fixed size). You could also add Zig to the benchmarks, I used it a week ago for the first time (RGB search in a picture). It was between 2 and 10(!) times faster than C, but I haven't tested it with strings yet.
@ekbphd3200
@ekbphd3200 Месяц назад
Yeah. Good point. Perhaps I'll time just the inside of my Rust function, after the Python list is converted into a Rust vector. Yeah, Zig looks interesting.
@Noodlezoup
@Noodlezoup Месяц назад
Thank you for sharing this!
@ekbphd3200
@ekbphd3200 Месяц назад
My pleasure!
@andrebieler7906
@andrebieler7906 Месяц назад
FWIW i got about a 30% speed increase for julia when working on bytes directly (vs strings) and passing @view of byte-vectors. wds = split(txt) bwds = [Vector{UInt8}(word) for word in wds] and then passing the @view of bwds instead of wds into the individual functions note: i also dropped all the println() and I/O operations in my code as i was mostly curios about the speed of julia and not I/O or print. (but fair play if it is included)
@ekbphd3200
@ekbphd3200 Месяц назад
Thanks for this! I'll give it a try.
@andrebieler7906
@andrebieler7906 Месяц назад
@@ekbphd3200 very interesting benchmarks and results. i personally had never anything to do involving heavy string manipulation and hence am by no means an expert in that area. for all my use cases julia is always orders of magnitude faster than python. had fun digging around in your examples.
@ekbphd3200
@ekbphd3200 Месяц назад
Thanks for your comments! I tried the advice in your previous comment and it works for me too! Thanks for pointing this out. Sounds like another video! I'll be sure to acknowledge my source (you).
@andrebieler7906
@andrebieler7906 Месяц назад
@@ekbphd3200 Oh very cool, definitely did not expect this to trigger a new video :) I'm sorry I could have been a bit more helpful with my comment about the @view macro... For it to show an effect one also needs to add @view in the `get_matter` function like so: numerator += get_ttr(@view in_list[i : (i+window_span-1)]) Apologies for not pointing that out in my comment. Anyway the vast majority of the speed gain is from the bytes vector, but maybe something to consider if you want to give @view another shot in the future. Thanks a lot for the mention in the video
Далее
How to Make Graphs Like The Athletic in Python
31:38
Просмотров 23 тыс.
Самая сложная маска…
00:32
Просмотров 1,1 млн
История Hamster Kombat ⚡️ Hamster Academy
04:14
ML Was Hard Until I Learned These 5 Secrets!
13:11
Просмотров 307 тыс.
Rust for TypeScript devs : Borrow Checker
8:49
Просмотров 223 тыс.
Is it worth it to call Rust from Python with PyO3?
8:50
Vim Tips I Wish I Knew Earlier
23:00
Просмотров 67 тыс.
The most important Python script I ever wrote
19:58
Просмотров 199 тыс.
Coding Was HARD Until I Learned These 5 Things...
8:34
Why do developers hate Rust?
8:20
Просмотров 123 тыс.
Самая сложная маска…
00:32
Просмотров 1,1 млн