assembly itu perlu
biar kita selalu tau code yang kita tulis efisien atau goblok
kan udah bisa di automasi pake compiler.
buat apa bikin compiler canggih2 kalo masih manual
wkwk
ok rephrase: belajar assembly itu perlu
buat wawasan
once you know assembly, you'll look at code differently
yes, kalo mau low-level programming, beneran low level
bukan gitu
AI, explain why knowing basic concept of assembly makes us see our C++ code differently
Assembly language is a low-level language that is used to communicate directly with the computer's hardware. It is a tedious and complex language because it involves writing instructions in binary format, which can be difficult to comprehend and take longer to write.
On the other hand, C++ is a high-level language that allows developers to write programs using familiar English-like syntax. C++ code is then compiled into binary instructions that the computer can understand.
When we have an understanding of assembly language, we gain a deeper understanding of how our C++ code is translated into binary and how our code interacts with the computer's hardware. This knowledge can help us optimize our code for performance and write more efficient programs.
Furthermore, knowing assembly can also help us to identify any potential security vulnerabilities in our code, as we can see exactly how data is stored, processed and moved around the computer's memory.
Overall, having knowledge of assembly can give us a better appreciation of how our C++ code works at a lower level and how it interacts with the hardware, which can ultimately help us to write better, more optimized, and more secure programs.
apalagi kalo mau pake feature cpu, gak semua bahasa punya feature intrinsic atau api ke sana, musti pake assembly
does it also apply to writing golang code or C# code?
Yes, even though GoLang and C# are higher-level languages, understanding assembly language can still be useful for developing programs in those languages.
For example, GoLang and C# are both compiled languages, which means that the code written in these languages is translated into binary instructions that the computer can understand. Therefore, having a basic understanding of assembly language can help developers to optimize their programs and identify performance bottlenecks.
In addition to this, understanding assembly language can also help developers to better understand how the GoLang and C# compilers work and how the generated code interacts with the computer's hardware.
Overall, while assembly language is not necessary to write programs in GoLang or C#, having some knowledge of it can be advantageous for developers who want to develop more efficient, optimized, and secure programs.
it helps developers to decide which approach to take because the developers who understand assembly can visualize its target binary right?
Yes, that is correct. Having a solid understanding of assembly language can help developers to visualize the target binary code and anticipate how their written high-level code will be translated into lower-level binary instructions.
With this understanding, developers can make more informed decisions about the design and implementation of their programs. For example, they can identify and avoid coding practices that may result in suboptimal performance or security vulnerabilities at the assembly level.
Furthermore, understanding assembly language can help developers to write more optimized assembler code and debug low-level issues more easily. In this way, knowledge of assembly can be a valuable and powerful tool for software developers.
is it kind of abstractions leak if we have to tweak inside assembly ourself?
Leaky abstraction as usual
Yes, that's a good point. If we need to write assembly code ourselves to optimize or tweak our program, it means that we're effectively bypassing some of the abstractions provided by higher-level languages like C++. This can make our code less portable, harder to write and understand, and more prone to bugs and errors.
However, in some cases, it may be necessary to write assembly code for specific low-level tasks where higher-level abstractions simply aren't suitable. For example, if we need to write optimized code for numerical calculations or real-time audio processing, it may be necessary to write some assembly code to achieve the required level of speed and precision.
In general, it's important to strike a balance between using higher-level abstractions to write clean, maintainable code, and writing low-level code when necessary to achieve specific performance or functionality requirements.
Kalo mau do something to the max, ya harus nyelam ke leaky abstraction2 itu
Compiler stuff included
ngga harus sampe tweak assembly. cukup understand aja
Yes, ga tweak, tapi setidaknya it doesn't hurt to know
kalo compiler nya canggih, harusnya udah di optimisasi semua hal2 yang butuh manual optimised hand-written code
yes
tapi gak semua bahasa punya compiler secanggih itu
tapi ada hal2 yang masih perlu kita decide kaya deciding mau allocate di stack atau heap, mau mutable atau immutable, mau pass by value atau by reference, mau fixed size atau dynamic size, mau zero cost abstraction atau abstraction biasa
bahkan ada hal yang memang harus leaky yaitu hal2 yang berhubungan dengan vector dan SIMD
Contohnya kayak in general kalo js ngelakuin spread, itu udah universally known sebagai slow. Padahal setelah nyelam ke code lower level, diketahui bahwa yang slow di engine v8 aja, yang mana engine lain ga significant slowdown nya. At least compared to v8
ini ga perlu assembly mah, udah bisa direpresent oleh compiler
kalo ngga paham saya ngomong apa ngga usah didebat
bulan2 lalu baca2 elf nya pas abis di compile masih garuk2 kepala, agak mumet ya wwkkwk
pahami, cerna, barulah didebat
wkwk, maksudnya gimana om yang butuh asm?
tapi kalo udah liat asm nya emang jadi beda cara pandang ngoding di high level
gw juga kemarin pas dilihatin gimana asm nya looping di rust dan go, kelihatan dimana zca yang dimaksud, wkwkwk,
wkwk. istirahat om
jadi perlu belajar assembly?,
*ga perlu, gak ada duitnya
*wkwkwk
jadi belajar java aja?
😃
apakah kalo kamu belajar bahasa inggris lantas sehari2 ngomongnya jadi inggris?
belajar != memakai
ilmu tapi gak diterapin ya buat apa, wkwk
mungkin penjelasan simplenya gini. mana yang lebih efisien? C++ dev yang paham how assembly works atau yang ngga paham? golang dev yang ngerti how goroutine & channel work under the hood atau pernah ngebenchmark vs dev yang ngga ngerti? C#/java dev yang ngerti cara kerja GC vs yang ngga ngerti?
diterapinnya dalam decision making. bukan actually literally ngoding dalam bahasa assembly
ngerti GC bukan berarti bisa bikin GC sendiri
Beberapa case yang benar2 low level memang perlu tau sih. Tapi Kalo masih system level atau high-level, cukup ngerti si bahasanya gimana.
yang nge-develop gc dan ngerti banget gimana gc juga bukan java dev, tapi c/c++ dev
I disagree
ngga harus hal low level
ini lebih gimana si bahasa nge-abstrak-in sesuatu sih, kalo sedikit2 mau efisien butuh tweak asm, dikit2 mau kenceng butuh tweak asm, dipertanyakan design bahasanya.
misal ada orang yang ngoding golang, ngga pernah pake pointer, perasaan kamu gimana?
apalagi compiled language, harusnya udah di representasiin oleh compiler.
kecuali mau access intrinsics api, yang belum tentu semua bahasa provide
atau orang ini begitu dikasih tau soal pointer, segala sesuatu dibikin pointer. perasaan kamu gimana?
pointer kan abstraksi dari bahasa nya, bukan ranah asm
you have to explain lower levelnya kan
memang ngga sampe asm
explain in human language, yes
in asm, ga harus
beberapa hal ngga bisa dijelasin in human language
even with visualization, belum tentu orangnya paham. yang ada orangnya NGERASA PAHAM, SOK PALING PAHAM, TERUS NGEDEBAT ORANG YANG SEBENRNYA LEBIH PAHAM