有没有办法优化这个程序?
CPU: Intel Sandy Bridge microarchitecture, speed 3.3e+06 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (No unit mask) count 100000
samples % image name app name symbol name
84683 12.3219 tyn_indexer tyn_indexer tyn_cmp_term32
61380 8.9311 tyn_indexer tyn_indexer tyn_binary_heap_heapify
60187 8.7576 tyn_indexer tyn_indexer tyn_p4d_encode32
29849 4.3432 tyn_indexer tyn_indexer tyn_exsorter_sort
29526 4.2962 tyn_indexer tyn_indexer tyn_cmp_node_term32
25441 3.7018 libc-2.14.90.so libc-2.14.90.so __memcpy_ssse3_back
25283 3.6788 tyn_indexer tyn_indexer tyn_binary_heap_insert
20537 2.9883 tyn_indexer tyn_indexer nodes_term32_flush
11966 1.7411 vmlinux vmlinux jbd2_journal_commit_transaction
11733 1.7072 vmlinux vmlinux __strnlen_user
10741 1.5629 vmlinux vmlinux nobh_truncate_page
9728 1.4155 vmlinux vmlinux generic_file_buffered_write
9443 1.3740 vmlinux vmlinux mpage_da_map_and_submit
9023 1.3129 vmlinux vmlinux do_get_write_access
7283 1.0597 vmlinux vmlinux invalidate_interrupt31
5894 0.8576 vmlinux vmlinux write_cache_pages_da
5332 0.7758 vmlinux vmlinux journal_submit_commit_record
5316 0.7735 vmlinux vmlinux hugetlbfs_symlink
5166 0.7517 vmlinux vmlinux mount_ns
4750 0.6912 vmlinux vmlinux threshold_interrupt
4680 0.6810 tyn_indexer tyn_indexer tyn_cmp_node_attr32
4526 0.6586 vmlinux vmlinux list_locations
4473 0.6508 vmlinux vmlinux generic_write_checks
4415 0.6424 vmlinux vmlinux hotplug_hrtick
4398 0.6399 vmlinux vmlinux rb_erase
4373 0.6363 libglib-2.0.so.0.3000.1 libglib-2.0.so.0.3000.1 /lib64/libglib-2.0.so.0.3000.1
4365 0.6351 vmlinux vmlinux fput
4356 0.6338 vmlinux vmlinux jbd2_journal_dirty_metadata
4197 0.6107 vmlinux vmlinux kmem_cache_open
4178 0.6079 vmlinux vmlinux generic_file_aio_read
3871 0.5633 libc-2.14.90.so libc-2.14.90.so __libc_disable_asynccancel
3869 0.5630 libc-2.14.90.so libc-2.14.90.so __libc_enable_asynccancel
3762 0.5474 vmlinux vmlinux __bread
3697 0.5379 vmlinux vmlinux bdi_writeback_thread
3608 0.5250 vmlinux vmlinux ext4_alloc_da_blocks
3537 0.5147 vmlinux vmlinux add_page_to_unevictable_list
3296 0.4796 vmlinux vmlinux hugetlbfs_read
3047 0.4434 vmlinux vmlinux audit_free
3041 0.4425 vmlinux vmlinux fget_raw_light
2872 0.4179 vmlinux vmlinux copy_from_user_nmi
答案 0 :(得分:0)
看到对内核例程的大量调用,它看起来你的代码是在日志文件系统上编写/映射文件。除非你真的需要这个提供的功能,否则如果你的代码性能至关重要,这可能不是一个好主意。
tmpfs
或类似的)只需将其复制到真实磁盘即可
计算结束了。答案 1 :(得分:0)
尝试使用AVL而不是堆。根据我的经验,AVL通常在实践中更快,除非你大量使用堆功能。