Actually, my main point is this passage:
Since those factors affect program efficiency, why not bypass them? There are various optimization techniques, which must be combined with platform and programming language characteristics to make the best use of advantages and avoid disadvantages.
The garbage collection mechanism does affect performance, but it also has benefits.
First, write a linked list program using those purely compiled programming languages without using STL and other data structure libraries.
Then write the same program using Java, .Net (of course, not using their class libraries, but new-ing linked list nodes one by one).
Now fill in a large number of node data and see.
You will be depressed to find that those purely compiled codes are actually not faster than the virtual machine.
This is because the memory allocation functions of general programming tools call the operating system's memory allocation functions, and the operating system's heap allocation functions are not originally designed for allocating a large number of small objects. So many classic data structure textbooks recommend us to write our own memory allocator, specifically for memory allocation of small objects like linked list nodes. That's why STL is now advocated.
And the garbage collection mechanism was originally designed to solve such problems and can handle the allocation of a large number of small objects like this.
Actually, I don't like Java, .Net either because they are specifically designed for web services, so many test results are deceptive. But precisely because of this, I once carefully analyzed their performance. The result is that for those fields that current programming beginners are exposed to, Java, .Net have been optimized to the extreme, and they seem to be really fast. But for traditional fields, they naturally can't compare.
[ Last edited by zyl910 on 2006-7-11 at 22:25 ]
Originally posted by zyl910 at 2006-7-11 15:20:
And now it's calling an interrupt.
The time is mainly consumed in the interrupt service routine.
That is, the bottleneck at this time is the hard disk read/write speed.
Originally posted by asbai at 2006-7-11 20:46:
Specifically, languages that use mechanisms such as garbage collection and automatic memory management; untyped variables; reflection, etc., are inherently inefficient. Such languages won't run fast even if directly compiled into machine code. Interestingly, they may even run slower. There is an article in the IBM Knowledge Base specifically measuring the efficiency of Java in various situations: Weighing in on Java native compilation (http://www-128.ibm.com/developerworks/library/j-native.html).
Since those factors affect program efficiency, why not bypass them? There are various optimization techniques, which must be combined with platform and programming language characteristics to make the best use of advantages and avoid disadvantages.
The garbage collection mechanism does affect performance, but it also has benefits.
First, write a linked list program using those purely compiled programming languages without using STL and other data structure libraries.
Then write the same program using Java, .Net (of course, not using their class libraries, but new-ing linked list nodes one by one).
Now fill in a large number of node data and see.
You will be depressed to find that those purely compiled codes are actually not faster than the virtual machine.
This is because the memory allocation functions of general programming tools call the operating system's memory allocation functions, and the operating system's heap allocation functions are not originally designed for allocating a large number of small objects. So many classic data structure textbooks recommend us to write our own memory allocator, specifically for memory allocation of small objects like linked list nodes. That's why STL is now advocated.
And the garbage collection mechanism was originally designed to solve such problems and can handle the allocation of a large number of small objects like this.
Actually, I don't like Java, .Net either because they are specifically designed for web services, so many test results are deceptive. But precisely because of this, I once carefully analyzed their performance. The result is that for those fields that current programming beginners are exposed to, Java, .Net have been optimized to the extreme, and they seem to be really fast. But for traditional fields, they naturally can't compare.
[ Last edited by zyl910 on 2006-7-11 at 22:25 ]
人类存在的目的就是试图理解人类为何存在





