Question

When I use NASM to assemble asm code, around 200,000 and even more(2.6 Gz Ununtu 12.04 32bit 4 core), I find the assemble speed is too slow(4 minutes? even longer? I did not explicitly count the time consumption)

So I am wondering Is there any way to leverage multicore to speed up nasm assembling process?

I google but nothing useful found...

Thank you!

Was it helpful?

Solution

You could split your huge asm file into multiple parts and assemble each separately in parallel (for example make -j4 if you are using makefiles) then link them together.

OTHER TIPS

Use FASM instead. It has very similar syntax (the transition is easy possible) and is much, much faster, because it is written in assembly language.

In my project Fresh IDE, 300K+ source lines (results in 260kB executable) are compiled for less than 3 seconds on 1.8GHz 32bit CPU and FASM version 1.71.19

For most assemblers, there's virtually no code optimisation at all and almost all CPU time is spent pre-processing and parsing. The single largest bottleneck for actual speed is typically disk access times (which has nothing to do with CPU/processing).

In that case; things that will help include installing faster hard disks or SSD (especially if you're working with a large number of tiny files where seek times matter far more), increasing available RAM (larger file caches), and possibly de-fragmenting your disks (if appropriate).

Using multiple CPUs won't speed up disk access times. Switching to a different assembler won't either.

For generating object files and then linking; instead of loading X source files from disk and assembling them; you end up loading X object files from disk and linking them (plus the overhead of loading/starting "make" and letting it parse the makefile, plus the overhead of detecting when files changed, plus reading any source files that did change and assembling and writing the object files, plus loading/starting the linker and letting it parse the linker script). Basically; it can easily make things worse.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top