C/C++语言性能分析方法及性能分析工具的使用

2023-05-16

文章目录

    • 一、从算法复杂度都程序性能
      • 一、事后统计的方法
      • 二、事前分析估算的方法
      • 三、求解算法的时间复杂度的具体步骤
      • 四、算法复杂度和程序性能之间的关系
      • 五、执行什么语句耗时?不同语句执行时间量级分析
        • 整型加和减:
        • 浮点型加和减
        • 测试打印printf
        • 函数调用
    • 二、程序性能分析工具
      • 1.gprof
        • gprof介绍
        • gprof安装
        • gprof使用步骤
        • 实战一:用gprof测试基本函数调用及控制流
          • 测试代码
          • 操作步骤

一、从算法复杂度都程序性能

我们第一次接触关于代码性能相关概念,应该是在学数据结构中的算法时间复杂度上面。

算法的时间复杂度反映了程序执行时间随输入规模增长而增长的量级,在很大程度上能很好反映出算法的优劣与否。因此,作为程序员,掌握基本的算法时间复杂度分析方法是很有必要的。
算法执行时间需通过依据该算法编制的程序在计算机上运行时所消耗的时间来度量。而度量一个程序的执行时间通常有两种方法。

一、事后统计的方法

这种方法可行,但不是一个好的方法。该方法有两个缺陷:一是要想对设计的算法的运行性能进行评测,必须先依据算法编制相应的程序并实际运行;二是所得时间的统计量依赖于计算机的硬件、软件等环境因素,有时容易掩盖算法本身的优势。

二、事前分析估算的方法

因事后统计方法更多的依赖于计算机的硬件、软件等环境因素,有时容易掩盖算法本身的优劣。因此人们常常采用事前分析估算的方法。

在编写程序前,依据统计方法对算法进行估算。一个用高级语言编写的程序在计算机上运行时所消耗的时间取决于下列因素:

(1). 算法采用的策略、方法;(2). 编译产生的代码质量;(3). 问题的输入规模;(4). 机器执行指令的速度。
一个算法是由控制结构(顺序、分支和循环3种)和原操作(指固有数据类型的操作)构成的,则算法时间取决于两者的综合效果。为了便于比较同一个问题的不同算法,通常的做法是,从算法中选取一种对于所研究的问题(或算法类型)来说是基本操作的原操作,以该基本操作的重复执行的次数作为算法的时间量度。

三、求解算法的时间复杂度的具体步骤

求解算法的时间复杂度的具体步骤是:

⑴ 找出算法中的基本语句;

算法中执行次数最多的那条语句就是基本语句,通常是最内层循环的循环体。

⑵ 计算基本语句的执行次数的数量级;

只需计算基本语句执行次数的数量级,这就意味着只要保证基本语句执行次数的函数中的最高次幂正确即可,可以忽略所有低次幂和最高次幂的系数。这样能够简化算法分析,并且使注意力集中在最重要的一点上:增长率。

⑶ 用大Ο记号表示算法的时间性能。

将基本语句执行次数的数量级放入大Ο记号中。

四、算法复杂度和程序性能之间的关系

首先从整体上来说,算法复杂度是针对代码片段的执行次数的一个量级估计的方法,只能从量级的角度评估该代码片段的性能。程序性能则是从实际运行的角度来衡量一个程序的性能。

算法复杂度只影响局部代码的性能,程序性能是对整个程序性能的评估。

算法复杂度是否会对整体程序性能有影响要视情况而定,还收到其他代码片段性能、执行次数、执行语句是否耗时等影响。

五、执行什么语句耗时?不同语句执行时间量级分析

之前写的一些博客可以拿来补充:

VxWorks实时性能探究

测试C语言中打印一句 hello world需要耗费多少时间

这次继续深入探究一下执行不同语句的耗时情况。

在我们的代码中,存在的比较典型的代码语句包括,算术运算,循环,逻辑判断,函数调用,打印,文件IO等。下面我们就测试一下这些语句在我电脑编译环境下的耗时情况。(注意不同的编译器和硬件配置会有不同的结果)

整型加和减:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main()
{
	clock_t begin, end;
	double cost;
	//开始记录
	begin = clock();
	/*待测试程序段*/
	int a = 1;
	for (int i = 0; i < 100000000; i++) {
		a = a + 1;//a = a - 1;
	}

	//结束记录
	end = clock();
	cost = (double)(end - begin)/CLOCKS_PER_SEC;
	printf("constant CLOCKS_PER_SEC is: %ld, time cost is: %lf secs", CLOCKS_PER_SEC, cost);
}

constant CLOCKS_PER_SEC is: 1000, time cost is: 0.055000 secs

55 ms/ 100000000 = 55000 us/100000000 = 0.00055 us = 0.55 ns

整型乘 和 整型加和减也差不多。

整型除 相比上面会更耗时,但量级差不多。

浮点型加和减

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main()
{
	clock_t begin, end;
	double cost;
	//开始记录
	begin = clock();
	/*待测试程序段*/
	double a = 1.0;
	for (int i = 0; i < 100000000; i++) {
		a = a + 1;//a = a-1;
	}

	//结束记录
	end = clock();
	cost = (double)(end - begin)/CLOCKS_PER_SEC;
	printf("constant CLOCKS_PER_SEC is: %ld, time cost is: %lf secs", CLOCKS_PER_SEC, cost);
}

constant CLOCKS_PER_SEC is: 1000, time cost is: 0.273000 secs

可以看出浮点型的加和减耗时大概是整型加减的5倍

浮点乘除:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main()
{
	clock_t begin, end;
	double cost;
	//开始记录
	begin = clock();
	/*待测试程序段*/
	double a = 1.0;
	for (int i = 0; i < 100000000; i++) {
		a = a / i;
	}

	//结束记录
	end = clock();
	cost = (double)(end - begin)/CLOCKS_PER_SEC;
	printf("constant CLOCKS_PER_SEC is: %ld, time cost is: %lf secs", CLOCKS_PER_SEC, cost);
}

constant CLOCKS_PER_SEC is: 1000, time cost is: 0.509000 secs

浮点型的乘和除耗时大概是浮点型的加和减耗时的2倍。

但总体来看进行算术运算的耗时还是比较小的。

测试打印printf

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main()
{
	clock_t begin, end;
	double cost;
	//开始记录
	begin = clock();
	/*待测试程序段*/
	
	for (int i = 0; i < 1000; i++) {
		printf("h");
	}

	//结束记录
	end = clock();
	cost = (double)(end - begin)/CLOCKS_PER_SEC;
	printf("constant CLOCKS_PER_SEC is: %ld, time cost is: %lf secs", CLOCKS_PER_SEC, cost);
}

constant CLOCKS_PER_SEC is: 1000, time cost is: 0.025000 secs

25 ms/ 1000 = 0.025 ms =25 us

测试还发现一个有趣的现象,打印语句耗时和打印的内容中字符的长短有关。

如果 printf(“h”) 改成 printf(“hh”) 、printf(“hhh”)、printf(“hhhh”)、printf(“hhhhh”)。则耗时分别变成

constant CLOCKS_PER_SEC is: 1000, time cost is: 0.053000 secs

constant CLOCKS_PER_SEC is: 1000, time cost is: 0.076000 secs

constant CLOCKS_PER_SEC is: 1000, time cost is: 0.108000 secs

constant CLOCKS_PER_SEC is: 1000, time cost is: 0.142000 secs

差不多和字符的长度成正比。

函数调用

其实在C语言中,我们都会把经常要调用的代码不长的函数弄成宏或内联函数,这样可以提高运行效率。

这篇博客讲解了一下函数调用耗时的情况:函数调用太多了会有性能问题吗?

下面我们来测试一下函数调用:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int callme(int a) {
	a = a + 1;
	return a;
}

int main()
{
	clock_t begin, end;
	double cost;
	//开始记录
	begin = clock();
	/*待测试程序段*/
	int b;
	for (int i = 0; i < 1000000000; i++) {
		b = callme(i);
	}

	//结束记录
	end = clock();
	cost = (double)(end - begin)/CLOCKS_PER_SEC;
	printf("constant CLOCKS_PER_SEC is: %ld, time cost is: %lf secs", CLOCKS_PER_SEC, cost);
}

constant CLOCKS_PER_SEC is: 1000, time cost is: 1.198000 secs

1.198s = 1198000000 ns / 1000000000 =1.19 ns

可以看到和上面那篇博客的计算的耗时是差不多的。

二、程序性能分析工具

1.gprof

gprof是一款 GNU profile工具,可以运行于linux、AIX、Sun等操作系统进行C、C++、Pascal、Fortran程序的性能分析,用于程序的性能优化以及程序瓶颈问题的查找和解决。

gprof介绍

gprof(GNU profiler)是GNU binutils工具集中的一个工具,linux系统当中会自带这个工具。它可以分析程序的性能,能给出函数调用时间、调用次数和调用关系,找出程序的瓶颈所在。在编译和链接选项中都加入-pg之后,gcc会在每个函数中插入代码片段,用于记录函数间的调用关系和调用次数,并采集函数的调用时间。

gprof安装

gprof是gcc自带的工具,一般无需额外安装步骤。

首先检查工具是否已经安装在系统上。 为此,只需在终端中运行以下命令即可。

$ gprof

如果您收到以下错误:

$ a.out: No such file or directory

那么这意味着该工具已经安装。 否则可以使用以下命令安装它:

$ apt-get install binutils

gprof使用步骤

1. 用gcc、g++、xlC编译程序时,使用-pg参数

如:g++ -pg -o test.exe test.cpp

编译器会自动在目标代码中插入用于性能测试的代码片断,这些代码在程序运行时采集并记录函数的调用关系和调用次数,并记录函数自身执行时间和被调用函数的执行时间。

2. 执行编译后的可执行程序,生成文件gmon.out

如:./test.exe

该步骤运行程序的时间会稍慢于正常编译的可执行程序的运行时间。程序运行结束后,会在程序所在路径下生成一个缺省文件名为gmon.out的文件,这个文件就是记录程序运行的性能、调用关系、调用次数等信息的数据文件。

3. 使用gprof命令来分析记录程序运行信息的gmon.out文件

如:gprof test.exe gmon.out

可以在显示器上看到函数调用相关的统计、分析信息。上述信息也可以采用gprof test.exe gmon.out> gprofresult.txt重定向到文本文件以便于后续分析。

实战一:用gprof测试基本函数调用及控制流

测试代码
#include <stdio.h>

void loop(int n){
    int m = 0;
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            m++;    
        }   
    }
}

void fun2(){
    return;
}

void fun1(){
    fun2();
}

int main(){
    loop(10000);

    //fun1callfun2
    fun1(); 

    return 0; 
}
操作步骤
liboxuan@ubuntu:~/Desktop$ vim test.c
liboxuan@ubuntu:~/Desktop$ gcc -pg -o test_gprof test.c 
liboxuan@ubuntu:~/Desktop$ ./test_gprof 
liboxuan@ubuntu:~/Desktop$ gprof ./test_gprof gmon.out
# 报告逻辑是数据表 + 表项解释
Flat profile:

# 1.第一张表是各个函数的执行和性能报告。
Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls  ms/call  ms/call  name    
101.20      0.12     0.12        1   121.45   121.45  loop
  0.00      0.12     0.00        1     0.00     0.00  fun1
  0.00      0.12     0.00        1     0.00     0.00  fun2

 %         the percentage of the total running time of the
time       program used by this function.

cumulative a running sum of the number of seconds accounted
 seconds   for by this function and those listed above it.

 self      the number of seconds accounted for by this
seconds    function alone.  This is the major sort for this
           listing.

calls      the number of times this function was invoked, if
           this function is profiled, else blank.

 self      the average number of milliseconds spent in this
ms/call    function per call, if this function is profiled,
       else blank.

 total     the average number of milliseconds spent in this
ms/call    function and its descendents per call, if this
       function is profiled, else blank.

name       the name of the function.  This is the minor sort
           for this listing. The index shows the location of
       the function in the gprof listing. If the index is
       in parenthesis it shows where it would appear in
       the gprof listing if it were to be printed.


Copyright (C) 2012-2015 Free Software Foundation, Inc.

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.


# 2.第二张表是程序运行时的
             Call graph (explanation follows)


granularity: each sample hit covers 2 byte(s) for 8.23% of 0.12 seconds

index % time    self  children    called     name
                0.12    0.00       1/1           main [2]
[1]    100.0    0.12    0.00       1         loop [1]
-----------------------------------------------
                                                 <spontaneous>
[2]    100.0    0.00    0.12                 main [2]
                0.12    0.00       1/1           loop [1]
                0.00    0.00       1/1           fun1 [3]
-----------------------------------------------
                0.00    0.00       1/1           main [2]
[3]      0.0    0.00    0.00       1         fun1 [3]
                0.00    0.00       1/1           fun2 [4]
-----------------------------------------------
                0.00    0.00       1/1           fun1 [3]
[4]      0.0    0.00    0.00       1         fun2 [4]
-----------------------------------------------

 This table describes the call tree of the program, and was sorted by
 the total amount of time spent in each function and its children.

 Each entry in this table consists of several lines.  The line with the
 index number at the left hand margin lists the current function.
 The lines above it list the functions that called this function,
 and the lines below it list the functions this one called.
 This line lists:
     index  A unique number given to each element of the table.
        Index numbers are sorted numerically.
        The index number is printed next to every function name so
        it is easier to look up where the function is in the table.

     % time This is the percentage of the `total' time that was spent
        in this function and its children.  Note that due to
        different viewpoints, functions excluded by options, etc,
        these numbers will NOT add up to 100%.

     self   This is the total amount of time spent in this function.

     children   This is the total amount of time propagated into this
        function by its children.

     called This is the number of times the function was called.
        If the function called itself recursively, the number
        only includes non-recursive calls, and is followed by
        a `+' and the number of recursive calls.

     name   The name of the current function.  The index number is
        printed after it.  If the function is a member of a
        cycle, the cycle number is printed between the
        function's name and the index number.


 For the function's parents, the fields have the following meanings:

     self   This is the amount of time that was propagated directly
        from the function into this parent.

     children   This is the amount of time that was propagated from
        the function's children into this parent.

     called This is the number of times this parent called the
        function `/' the total number of times the function
        was called.  Recursive calls to the function are not
        included in the number after the `/'.

     name   This is the name of the parent.  The parent's index
        number is printed after it.  If the parent is a
        member of a cycle, the cycle number is printed between
        the name and the index number.

 If the parents of the function cannot be determined, the word
 `<spontaneous>' is printed in the `name' field, and all the other
 fields are blank.

 For the function's children, the fields have the following meanings:

     self   This is the amount of time that was propagated directly
        from the child into the function.

     children   This is the amount of time that was propagated from the
        child's children to the function.

     called This is the number of times the function called
        this child `/' the total number of times the child
        was called.  Recursive calls by the child are not
        listed in the number after the `/'.

     name   This is the name of the child.  The child's index
        number is printed after it.  If the child is a
        member of a cycle, the cycle number is printed
        between the name and the index number.

 If there are any cycles (circles) in the call graph, there is an
 entry for the cycle-as-a-whole.  This entry shows who called the
 cycle (as parents) and the members of the cycle (as children.)
 The `+' recursive calls entry shows the number of function calls that
 were internal to the cycle, and the calls entry for each member shows,
 for that member, how many times it was called from other members of
 the cycle.


Copyright (C) 2012-2015 Free Software Foundation, Inc.

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
# 第三张表是函数与其在报告中序号的对应表

Index by function name

   [3] fun1                    [4] fun2                    [1] loop
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

C/C++语言性能分析方法及性能分析工具的使用 的相关文章

  • Linux中C语言标准库glibc源码下载

    在这篇文章理清gcc libc glibc libc 43 43 libstdc 43 43 的关系 xff0c 我们大概理解了libc xff0c glibc之间的一些关系 下面我们就开了解一些Linux中C语言标准库glibc源码 在这
  • 记录、总结、复盘的重要性和方法(另有周报、月报、年度总结撰写方法)

    文章目录 一 记录1 记录的分类2 学习记录3 工作记录定义分类作用提醒作用跟踪作用证明作用 写好日志时间维度内容维度感想维度 4 生活记录 二 总结和复盘1 总结2 复盘什么叫做复盘 xff1f 什么时候复盘比较合适 xff1f 怎样进行
  • PPT画图文章总结

    一图抵千言 xff0c 在平常的PPT汇报中 xff0c 一张好的图片可以让我们的展示更加清晰 xff0c 也让听得人更快的了解我们的内容 要想起之前师兄发了文章 xff0c 需要提供一个封面示意图 xff0c 当时好像是花钱请别人做的 x
  • 传统学科怎么和深度学习领域结合

    这篇博客 程序员读论文 LeCun Y Bengio Y amp Hinton G Deep learning Nature 521 436 444 2015 中的论文提到深度学习将在很多行业上有广阔的前景 最近看到毕导的公众号发文菜鸡程序
  • 现在快2022年了,c++为什么还要实现(.cpp)和声明(.h)分开?像 Java 或 C# 都不需要声明头文件,C++ 委员会为什么不解决这个问题?

    链接 xff1a https www zhihu com question 506962663 answer 2278836594 因为 C 43 43 牵扯面更广 xff0c 改起来更麻烦 很多语言其实都有一个事实上的实现标准 xff0c
  • Java程序设计基础

    文章目录 Java标识符和关键字标识符关键字 Java注释 xff1a 单行 多行和文档注释1 xff09 单行注释2 xff09 多行注释3 xff09 文档注释 Javadoc xff08 文档注释 xff09 详解Javadoc标签J
  • 几本对于笔试和面试有用的书(干货~)

    黑客帝国 jpg 这儿放几本对程序员笔试和面试有益的书籍o o the power of coding coder jpg 4本408核心书籍 xff1a 数据结构计算机操作系统计算机网络计算机组成原理 面试宝典 xff1a 程序员面试宝典
  • Java类和对象

    文章目录 本章学习要点 Java面向对象 xff1a 对象的概念及面向对象的三个基本特征对象的概念面向对象的三大核心特性继承性封装性多态性 Java认识类和对象Java类的定义及定义类时可用的关键字例 1 Java类的属性 xff1a 成员
  • Java流程控制语句

    文章目录 Java语句 xff1a Java空语句 复合语句和表达式语句语句编写方式空语句表达式语句复合语句例 1 Java if else分支结构精讲if 结构例 1例 2例 3 if else 结构例 4 多条件 if else if
  • Java数组:针对数组(Array)的各种操作

    文章目录 本章学习要点 Java数组简介 xff1a 数组是什么 xff1f Java一维数组的定义 赋值和初始化创建一维数组分配空间例 1 初始化一维数组1 xff09 使用 new 指定数组大小后进行初始化例 22 xff09 使用 n
  • java中类的main方法总结

    一 java中每个类都需要有main方法吗 xff1f 每个类可以有也可以没有main方法 xff0c 甚至所有类里可以都没有main方法 如果你想从某个类做为入口开始运行整个程序 那么就把他设成 public xff0c 之后再里面写个m
  • java中文件名、类名之间的关系

    1 Java保存的文件名必须与类名一致 xff1b 2 如果文件中只有一个类 xff0c 文件名必须与类名一致 xff1b 3 一个Java文件中只能有一个public类 xff1b 4 如果文件中不止一个类 xff0c 文件名必须与pub
  • Java 包(package)详解

    为了更好地组织类 xff0c Java 提供了包机制 xff0c 用于区别类名的命名空间 包的作用 1 把功能相似或相关的类或接口组织在同一个包中 xff0c 方便类的查找和使用 2 如同文件夹一样 xff0c 包也采用了树形目录的存储方式
  • 软件项目开发流程以及人员职责,软件工程中五种常用的软件开发模型整理

    文章目录 一 软件项目开发流程逻辑图开发流程需求分析概要设计详细设计编码测试软件交付验收维护 软件维护软件升级 软件项目开发流程以及人员职责软件工程中五种常用的软件开发模型整理软件系统开发流程七大详细步骤完整介绍 一 软件项目开发流程逻辑图
  • 如何保持专注

    文章目录 部分 1 做一个井井有条的人部分 2 提高专注力部分 3 在集中期间保持动力 专家建议小提示 转载于 xff1a https zh wikihow com E4 BF 9D E6 8C 81 E4 B8 93 E6 B3 A8 不
  • 让开始学java的我困惑的问题解析

    前面已经对java一些基础概念进行了理解 xff1a Java 包 package 详解 java中文件名 类名之间的关系 java中类的main方法总结 文章目录 一个java文件中可以有多个class xff0c 但是只能有一个是pub
  • Jar包详解

    jar包的一些事儿 关于 JAR 包我们应该知道的s
  • astra 深度相机 + orbslam2 ~ 稠密建图

    在ROS下运行ORB SLAM2 主要包括以下几步 xff1a 一 创建ROS工作空间 二 下载usb cam xff08 单目相机驱动包 xff09 三 下载深度相机驱动包 四 下载ORB SLAM2稠密建图代码 五 运行 一 创建ROS
  • Java字符串的处理

    文章目录 本章学习要点 Java定义字符串 xff08 2种方式 xff09 直接定义字符串例 1 使用 String 类定义1 String 2 String String original 3 String char value 4 S

随机推荐

  • Java数字和日期处理:Java数字处理和日期类

    文章目录 本章学习要点 Java Math类的常用方法静态常量例 1 求最大值 最小值和绝对值例 2 求整运算例 3 三角函数运算例 4 指数运算例 5 Java生成随机数 xff08 random 和Random类 xff09 例 1例
  • Java内置的包装类

    文章目录 本章学习要点 Java包装类 装箱和拆箱装箱和拆箱包装类的应用1 实现 int 和 Integer 的相互转换2 将字符串转换为数值类型3 将整数转换为字符串 Java Object类详解toString 方法equals 方法例
  • Java输入/输出(I/O)流

    文章目录 本章学习要点 Java流是什么 xff1f 输入 输出流又是什么 xff1f 什么是输入 输出流输入流输出流 Java系统流例 1 Java字符编码介绍Java File类 xff08 文件操作类 xff09 详解获取文件属性例
  • Java异常处理

    文章目录 本章学习要点 Java异常 xff08 Exception xff09 处理及常见异常异常简介例 1 异常类型 Java中Error和Exception的异同例 1 Java异常处理机制及异常处理的基本结构Java try cat
  • Java注解

    文章目录 本章学习要点 Java注解 xff08 Annotation xff09 简介Java 64 Override注解Java 64 Deprecated注解Java 64 SuppressWarnings xff1a 抑制编译器警告
  • 如何夸人?

    文章目录 夸人要怎么夸到心坎上 xff1f 01 有理有据 xff0c 细节见诚意02 一如既往保持信任与支持03 由表及里 xff0c 夸TA前先夸自己04 先抑后扬 xff0c 对比式夸奖05 创造条件引导TA自夸 如何做一只舔狗 xf
  • Java继承和多态

    文章目录 本章学习要点 Java类的封装例 1 Java封装图书信息类Java继承 xff08 extends xff09 简明教程例 1 单继承继承的优缺点 Java super关键字详解super调用父类构造方法例1例2 super访问
  • java中接口(interface)详解

    分享记录一下java接口的博客 xff1a java中接口 xff08 interface xff09 详解 JAVA基础 接口 xff08 全网最详细教程 xff09
  • java引用详解

    文章目录 一 关于对象与引用之间的一些基本概念 new Vehicle Vehicle veh1二 Java对象及引用三 只有理解了对象和引用的关系 xff0c 才能理解参数传递总结 xff1a 什么是值传递 xff0c 什么是引用传递 为
  • python学习-def __init__(self)理解(1)

    python中 init 的作用 在python中创建类后 xff0c 通常会创建一个 init 方法 xff0c 这个方法会在创建类的实例的时候自动执行 实例1 实例化Bob这个对象的时候 xff0c init 方法会自动执行 xff1a
  • 学完java基础语法之后用来练习的不依赖框架的小项目

    刚学完一门语言基础语法之后 xff0c 一般都需要写一些小项目来检验我们的学习效果 xff0c 将所学的基础语法串联起来 xff0c 同时也熟悉一下用这门语言做项目的大概流程 但是此时学习的项目不能太复杂 xff0c 因此此时才刚学完基础语
  • java集合中接口和类的理

    一 背景 首先我们可以先了解一下类和接口的基础和使用方法 xff1a Java类和对象 java中接口 xff08 interface xff09 详解 Java继承和多态 然后再对java集合的基础了解一下 Java集合 泛型和枚举 有了
  • java多线程详解

    文章目录 多线程基础进程进程 vs 线程多线程 创建新线程线程的优先级练习小结 线程的状态小结 中断线程小结 守护线程练习小结 线程同步不需要synchronized的操作小结 同步方法小结 死锁死锁练习小结 转载于 xff1a https
  • Java项目管理工具Maven使用方法详解

    这边直接推荐两个比较好的教程 xff1a https www liaoxuefeng com wiki 1252599548343744 1309301178105890 http c biancheng net maven2 depend
  • maven引入依赖包,import依赖包,编译运行maven项目

    文章目录 IDEA中新建一个maven项目在pom xml中添加依赖包 xff0c 确定依赖包成功导入 xff0c 在项目中import依赖包怎么确定maven成功的导入了依赖包在项目中import导入的依赖包总结 在看这篇博客之前 xff
  • 怎样做一个好的PPT演讲

    文章目录 一 做好PPT演讲的重要性二 怎么做好PPT演讲1 做一个好的PPT2 做好演讲 三 分析一些比较好的PPT演讲视频四 实例解析和总结 一 做好PPT演讲的重要性 不管是在学生时期的竞赛展示 xff0c 毕业答辩 xff0c 我们
  • PPT怎么画出好看的三维示意图

    一 前言 之前一些博客已经大致讲了PPT怎么画图的 xff1a PPT画图文章总结 怎样做一个好的PPT演讲 其实对于我们平常在PPT中会出现的图片 xff0c 可以简单的分为二维示意图和三维示意图 xff0c 二维示意图制作起来相对简单
  • 为什么C++没有Python那么多开源库?

    链接 xff1a https www zhihu com question 375368576 answer 1059898195 看了好多回答 xff0c 还是觉得有更本质的原因的 xff0c 根源还是在C 43 43 这个语言特性上 为
  • 为什么C++没有C语言快?

    作者 xff1a 高性能架构探索 链接 xff1a https www zhihu com question 507790994 answer 2287288696 来源 xff1a 知乎 著作权归作者所有 商业转载请联系作者获得授权 xf
  • C/C++语言性能分析方法及性能分析工具的使用

    文章目录 一 从算法复杂度都程序性能一 事后统计的方法二 事前分析估算的方法三 求解算法的时间复杂度的具体步骤四 算法复杂度和程序性能之间的关系五 执行什么语句耗时 xff1f 不同语句执行时间量级分析整型加和减 xff1a 浮点型加和减测