Похожие чаты

Is the speed of c function only depends on number

of clocks pulses?

4 ответов

18 просмотров

This is a weird statement to make. What do you mean speed of a function? Are you referring to the cycles taken by the call instruction?

Saeed-Aal boniat Автор вопроса
Manav | avoid unnecessary messaging me
This is a weird statement to make. What do you me...

I have two implementation that do the same thing How can I measure the speed of them to know which one is faster? Is there any unit or something to do that?

Saeed Aal boniat
I have two implementation that do the same thing H...

The one with better algorithmic complexity will be faster when the input size increases. For algorithms with the same complexity you can use a benchmarking library to determine which is faster. This will be a small constant factor which might vary from compiler to compiler and architecture to architecture. Generally these sort of optimizations are considered to be premature and tend to be done only when you need to squeeze out every ounce of performance and is typically done in OS code and Game engines and some math libraries. For the rest of the code out there, you generally don't need to do this.

Saeed Aal boniat
I have two implementation that do the same thing H...

+1 to Madhu and Manav What you are referring to is benchmarking. There are a lot of caveats in benchmarking as a lot of stuff can affect the results (different input data, processor architecture, data layout, other processes running, etc.). You can find some mentioned here: https://m.youtube.com/watch?v=r-TLSBdHe1A If your function is disconnected from other code, then as the first approximation I would suggest to use quickbench https://quick-bench.com/ (Note that there are caveats with it as well, you need to carefully choose what you don't want to optimize to measure the correct thing). If your function is part of the system and you want to measure things together, it can be more tricky depending on how often it is called and how much time it takes.

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта