Justification for using non-portable code

How to choose, someone justifies their compromises in terms of optimized code, clarity of implementation, efficiency and portability?

A suitable example for this question could be large file processing, where the “large file” is “quite a lot of GB” for a problem that will be simplified using random access methods.

Approaches for reading and changing this file can be:

  • To use streams in any case and look for the right place - portable, but potentially slow, and unclear - this will work for almost all operating systems.
  • match the corresponding part of the file as a large block. For example, mmap 50 MB file fragment to process for each fragment - this will work for many OSs, depending on the subtleties of mmap implementation for this system.
  • Just mmap the whole file - it requires a 64-bit OS, and this is the most efficient and clear way to implement this, but it does not work on 32-bit OS.
+3
source share
5 answers

Not sure what you are asking, but part of the design process is to analyze portability and performance requirements (among other factors).

, , , . .

, , , . , , , , .

+4

.

" ", , .

  • ( iPhone?)
  • ( ?)

"" .

, , /, "" WideFinder.

+2

, . , , . , ...

, ? , . , . . , , . , . , . , . , . , - , . , , - - , . .

, , - , , .

+2

. , , . .

, , .

+1

Portability for mobility was a marketing game for Java from the very beginning and is a fact of life for C by convention, and I believe that most of the people who support it have “grown up” with Java or C.

However, true, absolute mobility will be valid only for the simplest applications in most with an average degree of complexity - everything that requires high complexity will require special settings.

0
source

Source: https://habr.com/ru/post/1711137/


All Articles