java - Is there any reason to still use int as opposed to long on a 64 bit machine? -


in general, there reason still use int opposed long in java if programming on 64 bit architecture?

specifically in case:

i use int variables being mapped keys(sequential numbers starting 1 , incremented each new entry) of type number on oracle db table.

the db type number has way more precision int correct way model on java side long.

i stuck int efficiency reasons , because never have many entries in table need more int can represent.

on other hand, since modern machines 64 bit anyways, shouldn't make difference regarding efficiency on java side use long opposed int, right? guess make difference memory wise if load huge lists of keys memory not doing kind of operation.

on 64-bit processor, long give marginal performance boost because of alignment, registers, whatever (whether or not palpable debatable). comes drawback of using more space on stack , heap, impact performance negatively. really, depends on program, since there many factors impact performance.

i recommend use int, unless need 64-bit number. if know sure you're programming x86_64 architecture, think wouldn't matter, since these optimized handle 32-bit programs efficiently anyways.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -